create-react-app How to use webpack V5+ in yarn start

acruukt9  于 2个月前  发布在  React
关注(0)|答案(8)|浏览(79)

如何使用yarn start中的webpack V5

093gszye

093gszye1#

你是否已经删除了node_modules文件夹并重新安装?

polkgigr

polkgigr2#

我遇到了相同的问题,我尝试升级到 v5.0.0 ,但后来出现了 JS 内存溢出异常。所以我手动删除了 package-lock.json 并删除了文件夹 node_modules ,然后从头开始运行 npm i 。现在我也在 npm run startnpm run build 和所有 CI/CD 管道上遇到了相同的错误。有什么建议吗?

qmelpv7a

qmelpv7a3#

我遇到了相同的错误。

erhoui1w

erhoui1w4#

你的项目文件夹外有node_modules吗?

41ik7eoe

41ik7eoe5#

不,与srcpublicpackage.json处于同一水平。

7kjnsjlb

7kjnsjlb6#

运行npm why webpack时,你得到了什么输出?(如果你使用yarn,运行yarn why webpack时也问同样的问题)

ukdjmx9f

ukdjmx9f7#

yarn why v1.22.17
[1/4] 🤔  Why do we have the module "webpack"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "webpack@4.44.2"
info Reasons this module exists
   - "react-scripts" depends on it
   - Hoisted from "react-scripts#webpack"
info Disk size without dependencies: "3.57MB"
info Disk size with unique dependencies: "13.64MB"
info Disk size with transitive dependencies: "33.61MB"
info Number of shared dependencies: 140
=> Found "frappe-gantt-react#webpack@4.29.6"
info Reasons this module exists
   - "frappe-gantt-react#react-scripts" depends on it
   - Hoisted from "frappe-gantt-react#react-scripts#webpack"
info Disk size without dependencies: "10.34MB"
info Disk size with unique dependencies: "20.45MB"
info Disk size with transitive dependencies: "40.43MB"
info Number of shared dependencies: 141
✨  Done in 0.60s.
72qzrwbm

72qzrwbm8#

升级 react-scripts 以修复问题

相关问题