dva-init 初始化项目升级, package.json报错
react-18 报错

ncu -u 升级 package.json最新报错
- index.js:2177 Warning: Please use
require("history").createHashHistoryinstead ofrequire("history/createHashHistory"). Support for the latter will be removed in the next major release.- history的错误
- index.js:2177 Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it’s running React 17. Learn more: https://reactjs.org/link/switch-to-createroot
- react18的错误
- 解决:回退 react, react-dom版本为 @17.0.2
- https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#updates-to-client-rendering-apis
eslint@8报错
“eslint”: “^8.12.0”, 报错
The issue is with ESLint version 6.x. If upgrading Webstorm is not an option for you, you have to downgrade to ESLint version 5:
解决参考
https://stackoverflow.com/questions/57944468/webstorm-2018-1-4-eslint-typeerror-this-cliengine-is-not-a-constructor
- Failed to compile
./src/index.js
Module build failed: TypeError: eslint.CLIEngine is not a constructor
- 解决:降级 eslint版本为 @5
npm install eslint@5 eslint-plugin-flowtype@5 --save-dev
react-17 package.json
{"private": true,"scripts": {"start": "roadhog server","build": "roadhog build","test": "roadhog test","lint": "eslint --ext .js src test","precommit": "npm run lint"},"dependencies": {"dva": "^2.4.1","react": "^17.0.2","react-dom": "^17.0.2"},"devDependencies": {"babel-plugin-dva-hmr": "^0.4.2","eslint": "^5.16.0","eslint-config-umi": "^1.6.0","eslint-plugin-flowtype": "^5.10.0","eslint-plugin-import": "^2.25.4","eslint-plugin-jsx-a11y": "^6.5.1","eslint-plugin-react": "^7.29.4","husky": "^7.0.4","redbox-react": "^1.6.0","roadhog": "^2.5.0-beta.4"}}
总结
- 不建议使用 dva,使用 umijs3.x
- 自己封装维护脚手架,这样可以确保技术栈是最新的
