Closed chillJyx closed 5 months ago
每次修改config后重启项目,正常重新yarn start后启动项目,都无法启动成功,控制台报 Module does not exist in container 相关错误(未更改dva相关配置),每次需要清除.umi和node_modules .cache文件夹才可以
附图:
问题发生在打开 umi的dva配置后 umi配置:
// https://umijs.org/config/ import { defineConfig } from '@umijs/max'; import { join } from 'path'; import defaultSettings from './defaultSettings'; import proxy from './proxy'; import routes from './routes'; const { REACT_APP_ENV = 'dev' } = process.env; export default defineConfig({ hash: true, routes, theme: { 'root-entry-name': 'default', '@primary-color': '#20a7c9' }, proxy: proxy[REACT_APP_ENV as keyof typeof proxy], fastRefresh: true, //============== 以下都是max的插件配置 =============== model: {}, initialState: { // loading: '@ant-design/pro-layout/es/components/PageLoading/index.d.ts' }, title: '洛书数据平台', layout: { locale: true, ...defaultSettings, }, icons: { autoInstall: {} }, reactRouter5Compat: {}, historyWithQuery: {}, favicons:[ '/dark.svg' ], ignoreMomentLocale:false, locale: { // default zh-CN default: 'zh-CN', antd: true, // default true, when it is true, will use `navigator.language` overwrite default baseNavigator: true, }, antd: { momentPicker:true, theme:{ colorPrimary: '#20a7c9', } }, dva:{}, * @name 网络请求配置 * @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。 * @doc https://umijs.org/docs/max/request */ request: {}, access: {}, headScripts: [ { src: '/scripts/loading.js', async: true }, ], //================ pro 插件配置 ================= presets: ['umi-presets-pro'], // mock: { // include: ['mock/**/*', 'src/pages/**/_mock.ts'], // }, mfsu: { strategy: 'normal', }, requestRecord: {}, });
package.json:
{ "name": "ant-design-pro", "version": "6.0.0", "private": true, "description": "An out-of-box UI solution for enterprise applications", "scripts": { "analyze": "cross-env ANALYZE=1 max build", "build": "max build", "deploy": "npm run build && npm run gh-pages", "dev": "npm run start:dev", "gh-pages": "gh-pages -d dist", "i18n-remove": "pro i18n-remove --locale=zh-CN --write", "postinstall": "max setup", "jest": "jest", "lint": "npm run lint:js && npm run lint:prettier", "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ", "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", "lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto", "openapi": "max openapi", "prepare": "husky install", "prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"", "preview": "npm run build && max preview --port 8000", "record": "cross-env NODE_ENV=development REACT_APP_ENV=test max record --scene=login", "serve": "umi-serve", "start": "cross-env UMI_ENV=dev max dev", "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev", "start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev", "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev", "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev", "test": "jest", "test:coverage": "npm run jest -- --coverage", "test:update": "npm run jest -- -u", "tsc": "tsc --noEmit" }, "browserslist": [ "> 1%", "last 2 versions", "not ie <= 10" ], "dependencies": { "@ant-design/charts": "^0.9.4", "@ant-design/icons": "^4.8.1", "@ant-design/plots": "^2.1.5", "@ant-design/pro-components": "^2.6.44", "@antv/data-set": "^0.11.0", "@antv/l7": "^2.20.13", "@antv/l7-maps": "^2.20.13", "@antv/l7-react": "^2.4.3", "@babel/runtime-corejs3": "^7.12.5", "@data-ui/sparkline": "^0.0.84", "@fontsource/inter": "^4.0.0", "@jiaminghi/data-view-react": "^1.2.5", "@umijs/route-utils": "^2.2.2", "@vx/responsive": "^0.0.195", "abortcontroller-polyfill": "^1.1.9", "ace-builds": "^1.4.14", "antd": "^5.12.7", "antd-style": "^3.6.1", "array-move": "^2.2.1", "aws-sdk": "^2.809.0", "babel-plugin-typescript-to-proptypes": "^2.0.0", "bootstrap": "^3.4.1", "bootstrap-slider": "^10.0.0", "brace": "^0.11.1", "braft-editor": "^2.3.9", "broadcast-channel": "^4.10.0", "chrono-node": "^2.2.6", "classnames": "^2.5.1", "core-js": "^3.6.5", "crypto-js": "^4.1.1", "d3": "^7.7.0", "d3-array": "^1.2.4", "d3-color": "^1.2.0", "d3-scale": "^2.1.2", "dayjs": "^1.11.10", "dom-to-image-more": "^2.10.1", "echarts": "^5.4.3", "echarts-for-react": "^3.0.2", "fast-glob": "^3.2.7", "file-saver": "^2.0.5", "fontsource-fira-code": "^4.0.0", "fs-extra": "^10.0.0", "fuse.js": "^6.4.6", "geolib": "^2.0.24", "global-box": "^1.2.0", "html-webpack-plugin": "^5.3.2", "immer": "^9.0.6", "interweave": "^11.2.0", "jquery": "^3.5.1", "jr-qrcode": "^1.1.4", "js-cookie": "^2.2.1", "js-levenshtein": "^1.1.6", "js-yaml": "^4.1.0", "js-yaml-loader": "^1.2.2", "json-bigint": "^1.0.0", "json-stringify-pretty-compact": "^2.0.0", "jspdf": "^2.5.1", "jszip": "^3.6.0", "lodash": "^4.17.21", "lodash-es": "^4.17.21", "match-sorter": "^6.1.0", "memoize-one": "^5.1.1", "mini-css-extract-plugin": "^2.3.0", "moment": "^2.26.0", "moment-timezone": "^0.5.33", "mousetrap": "^1.6.1", "mustache": "^2.2.1", "numeral": "^2.0.6", "omit.js": "^2.0.2", "polished": "^3.7.2", "prop-types": "^15.7.2", "query-string": "^6.13.7", "querystring": "^0.2.1", "rc-menu": "^9.1.0", "rc-util": "^5.38.1", "re-resizable": "^6.6.1", "react": "^18.2.0", "react-ace": "^9.4.4", "react-checkbox-tree": "^1.5.1", "react-color": "^2.13.8", "react-contextmenu": "^2.14.0", "react-copy-to-clipboard": "^5.0.3", "react-datetime": "^3.0.4", "react-dev-inspector": "^1.7.0", "react-dnd": "^11.1.3", "react-dnd-html5-backend": "^11.1.3", "react-dom": "^18.2.0", "react-draggable": "^4.4.3", "react-fittext": "^1.0.0", "react-full-screen": "^1.1.1", "react-gravatar": "^2.6.1", "react-helmet-async": "^1.2.0", "react-highlight-words": "^0.16.0", "react-horizontal-timeline": "^1.5.3", "react-hot-loader": "^4.12.20", "react-image-gallery": "^1.2.7", "react-js-cron": "^1.2.0", "react-json-editor-ajrm": "^2.5.14", "react-json-tree": "^0.11.2", "react-json-view": "^1.21.3", "react-jsonschema-form": "^1.2.0", "react-lazy-load-image-component": "^1.6.0", "react-lines-ellipsis": "^0.15.0", "react-loadable": "^5.5.0", "react-markdown": "^4.3.1", "react-redux": "^9.1.0", "react-resize-detector": "^6.7.6", "react-reverse-portal": "^2.0.1", "react-router-dom": "^6.22.3", "react-search-input": "^0.11.3", "react-select": "^3.1.0", "react-sortable-hoc": "^1.11.0", "react-split": "^2.0.9", "react-sticky": "^6.0.3", "react-syntax-highlighter": "^15.4.5", "react-table": "^7.6.3", "react-transition-group": "^2.5.3", "react-ultimate-pagination": "^1.2.0", "react-use-websocket": "^4.3.1", "react-virtualized": "9.19.1", "react-virtualized-auto-sizer": "^1.0.2", "react-virtualized-select": "^3.1.3", "react-window": "^1.8.5", "redux": "^4.0.5", "redux-localstorage": "^0.4.1", "redux-thunk": "^2.1.0", "redux-undo": "^1.0.0-beta9-9-7", "regenerator-runtime": "^0.13.5", "rimraf": "^3.0.2", "rison": "^0.1.1", "scroll-into-view-if-needed": "^2.2.28", "shortid": "^2.2.6", "spark-md5": "^3.0.2", "three": "^0.99", "tinycolor2": "^1.4.2", "tslib": "^2.4.0", "umi-request": "^1.0.8", "urijs": "^1.19.8", "use-immer": "^0.6.0", "use-merge-value": "^1.0.1", "use-query-params": "^1.1.9", "video-react": "^0.14.1", "vis-data": "^7.1.1", "vis-graph3d": "^6.0.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.1/xlsx-0.19.1.tgz", "yargs": "^15.4.1" }, "devDependencies": { "@ant-design/pro-cli": "^2.1.5", "@testing-library/react": "^13.4.0", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/classnames": "^2.3.1", "@types/express": "^4.17.21", "@types/history": "^4.7.11", "@types/jest": "^29.5.11", "@types/lodash": "^4.14.202", "@types/lodash.debounce": "^4.0.9", "@types/react": "^18.2.46", "@types/react-dom": "^18.2.18", "@types/react-helmet": "^6.1.11", "@umijs/fabric": "^2.14.1", "@umijs/lint": "^4.1.0", "@umijs/max": "^4.1.0", "cross-env": "^7.0.3", "eslint": "^8.56.0", "express": "^4.18.2", "gh-pages": "^3.2.3", "husky": "^7.0.4", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "mockjs": "^1.1.0", "prettier": "^3.1.1", "prettier-plugin-organize-imports": "^3.2.4", "prettier-plugin-packagejson": "^2.4.8", "prettier-plugin-two-style-order": "^1.0.1", "react-dev-inspector": "^1.9.0", "swagger-ui-dist": "^4.19.1", "ts-node": "^10.9.2", "typescript": "^4.9.5", "umi-presets-pro": "^2.0.3" }, "engines": { "node": ">=12.0.0" } }
Steps to reproduce the behavior: 1. 2.
Expected behavior 1. 2.
给一个能复现加载失败的最小复现仓库吧。
What happens?
每次修改config后重启项目,正常重新yarn start后启动项目,都无法启动成功,控制台报 Module does not exist in container 相关错误(未更改dva相关配置),每次需要清除.umi和node_modules .cache文件夹才可以
附图:
Mini Showcase Repository(REQUIRED)
问题发生在打开 umi的dva配置后 umi配置:
package.json:
How To Reproduce
Steps to reproduce the behavior: 1. 2.
Expected behavior 1. 2.
Context