diff --git a/.umirc.ts b/.umirc.ts index b9c3a19..a72a838 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -12,9 +12,11 @@ export default defineConfig({ antd: {}, title: '趣谈前端-h5-dooring', exportStatic: {}, - base: 'h5_plus', - publicPath: '/h5_plus/', - outputPath: '../server/static/h5_plus', + base: '/', + publicPath: './', + outputPath: 'dist', + + esbuild: {}, routes: [ { diff --git a/package.json b/package.json index 24bc638..e0ff8b5 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "postinstall": "umi generate tmp", "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", "test": "umi-test", - "test:coverage": "umi-test --coverage" + "test:coverage": "umi-test --coverage", + "nocompress": "cross-env RM_TMPDIR=none COMPRESS=none umi build" }, "gitHooks": { "pre-commit": "lint-staged" @@ -51,6 +52,7 @@ "dependencies": { "@ant-design/icons": "^4.2.1", "@antv/f2": "^3.7.7", + "@umijs/plugin-esbuild": "^1.0.1", "@umijs/plugin-sass": "^1.1.1", "@umijs/preset-react": "1.x", "@umijs/test": "^3.2.19", @@ -96,6 +98,7 @@ "@typescript-eslint/parser": "4.1.1", "babel-eslint": "10.x", "babel-plugin-import": "^1.13.0", + "cross-env": "^7.0.2", "eslint": "6.x", "eslint-config-react-app": "^5.2.1", "eslint-plugin-flowtype": "4.x", diff --git a/src/app.tsx b/src/app.tsx index 3fa05da..6643078 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,12 +1,9 @@ -import { createLogger } from 'redux-logger'; import { message } from 'antd'; import undoable, { StateWithHistory } from 'redux-undo'; import { Reducer, AnyAction } from 'redux'; -import { isDev } from './utils/tool'; export const dva = { config: { - onAction: isDev ? createLogger() : undefined, onError(e: Error) { message.error(e.message, 3); }, diff --git a/src/components/Calibration/index.tsx b/src/components/Calibration/index.tsx index 78908c8..848d062 100644 --- a/src/components/Calibration/index.tsx +++ b/src/components/Calibration/index.tsx @@ -79,12 +79,12 @@ export default function Calibration(props: CalibrationTypes) { let height = calibrationLength.height ? calibrationLength.height : calibrationRef.current.getBoundingClientRect().height; - let arr = [...calibrationRef.current.querySelectorAll('.calibrationLine')]; + let arr = [...Array.from(calibrationRef.current.querySelectorAll('.calibrationLine'))]; if (arr.length) { if (direction === 'up') { calibrationRef.current.style.width = parseFloat(multiple.toFixed(1)) * width + 'px'; arr.forEach(el => { - let dom = [...el.querySelectorAll('.calibrationNumber')][0] as HTMLElement; + let dom = [...Array.from(el.querySelectorAll('.calibrationNumber'))][0] as HTMLElement; if (dom) { dom.style.transform = `translate3d(-4px, 16px, 0px) scale(${(multiple + 0.1).toFixed( 1, @@ -94,7 +94,7 @@ export default function Calibration(props: CalibrationTypes) { } else { calibrationRef.current.style.height = parseFloat(multiple.toFixed(1)) * height + 'px'; arr.forEach(el => { - let dom = [...el.querySelectorAll('.calibrationNumber')][0] as HTMLElement; + let dom = [...Array.from(el.querySelectorAll('.calibrationNumber'))][0] as HTMLElement; if (dom) { dom.style.transform = `translate3d(-4px, -8px, 0px) scale(${(multiple + 0.1).toFixed( 1, diff --git a/src/components/DynamicEngine/index.tsx b/src/components/DynamicEngine/index.tsx index 9ae8448..e7ee711 100644 --- a/src/components/DynamicEngine/index.tsx +++ b/src/components/DynamicEngine/index.tsx @@ -6,7 +6,7 @@ import React from 'react'; export type componentsType = 'media' | 'base' | 'visible'; -const DynamicFunc = (type: any, componentsType: string) => +const DynamicFunc = (type: string, componentsType: string) => dynamic({ loader: async function() { let Component: FC<{ isTpl: boolean }>; @@ -35,7 +35,7 @@ const DynamicFunc = (type: any, componentsType: string) => type DynamicType = { isTpl: boolean; config: { [key: string]: any }; - type: any; + type: string; componentsType: componentsType; category: string; }; @@ -44,7 +44,7 @@ const DynamicEngine = memo((props: DynamicType) => { const Dynamic = useMemo(() => { return (DynamicFunc(type, category) as unknown) as FC; // eslint-disable-next-line react-hooks/exhaustive-deps - }, [type, config]); + }, [config]); return ; }); diff --git a/src/pages/editor/Container.tsx b/src/pages/editor/Container.tsx index f08b90f..b17b4c7 100644 --- a/src/pages/editor/Container.tsx +++ b/src/pages/editor/Container.tsx @@ -111,6 +111,7 @@ const Container = (props: { history?: any; location?: any; pstate?: any; dispatc const [render] = useGetBall(setDragState, { innerStyle: { top: '10px', left: '10px', cursor: 'pointer' }, ratioSpeed: { x: 1.2, y: 1.2 }, + intervalDelay: 5, }); return ( diff --git a/src/pages/editor/SourceBox.tsx b/src/pages/editor/SourceBox.tsx index 2506ff8..614be25 100644 --- a/src/pages/editor/SourceBox.tsx +++ b/src/pages/editor/SourceBox.tsx @@ -102,6 +102,7 @@ const SourceBox = memo((props: SourceBoxProps) => { return ( { setDragState({ x: data.x, y: data.y }); }} diff --git a/tsconfig.json b/tsconfig.json index 425c6ae..3ee0d27 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es6", + "target": "es5", "module": "ESNext", "moduleResolution": "node", "jsx": "react", diff --git a/yarn.lock b/yarn.lock index eea9ccd..0a279c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2716,6 +2716,13 @@ dva-immer "^0.4.19" dva-loading "^3.0.20" +"@umijs/plugin-esbuild@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@umijs/plugin-esbuild/-/plugin-esbuild-1.0.1.tgz#7162a31d686340bd70dfe001bfb70e7d25afa192" + integrity sha512-YyxO33GFzy0s6HifHOjNqLkNxxxNJDaQ4tHKmYm5jO60LZ6A65R7O/ei1+EDKanudmpwU5Y+jevvVzzYbqmV4g== + dependencies: + esbuild-webpack-plugin "^1.0.0-beta.3" + "@umijs/plugin-helmet@1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@umijs/plugin-helmet/-/plugin-helmet-1.1.1.tgz#841aea37b5076b51c2f332659bf9c671cf63794d" @@ -4953,7 +4960,14 @@ crequire@1.8.1: resolved "https://registry.yarnpkg.com/crequire/-/crequire-1.8.1.tgz#ac81f204786b5f201194eb1698cf441b10a4b57d" integrity sha1-rIHyBHhrXyARlOsWmM9EGxCktX0= -cross-spawn@7.0.3, cross-spawn@^7.0.0: +cross-env@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9" + integrity sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw== + dependencies: + cross-spawn "^7.0.1" + +cross-spawn@7.0.3, cross-spawn@^7.0.0, cross-spawn@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -5899,6 +5913,18 @@ es6-weak-map@^2.0.2: es6-iterator "^2.0.3" es6-symbol "^3.1.1" +esbuild-webpack-plugin@^1.0.0-beta.3: + version "1.0.5" + resolved "https://registry.yarnpkg.com/esbuild-webpack-plugin/-/esbuild-webpack-plugin-1.0.5.tgz#68a6a377a84c991da1a0fc302830f514c9d47472" + integrity sha512-X/ektio8dxHD/bYk1BhT7XZw7U1ZJDu8VRjhc81W12Mizw0Fti+Wp4W4u1e9PiMdeDz/SXAO3U0A37wV7XT0wA== + dependencies: + esbuild "^0.6.8" + +esbuild@^0.6.8: + version "0.6.34" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.6.34.tgz#76565a60e006f45d5f273b6e59e61ed0816551f5" + integrity sha512-InRdL/Q96pUucPqovJzvuLhquZr6jOn81FDVwFjCKz1rYKIm9OdOC+7Fs4vr6x48vKBl5LzKgtjU39BUpO636A== + escalade@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.0.tgz#e8e2d7c7a8b76f6ee64c2181d6b8151441602d4e"