ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.35k stars 8.14k forks source link

🧐[问题]项目更新依赖后,启动或是打包报错 #9597

Closed flowerDAI closed 2 years ago

flowerDAI commented 2 years ago

🧐 问题描述

执行 ncu -u 后, 更新依赖后 报错 启动不行 : npm start 打包也不行 : npm run build

💻 示例代码

ERROR in ./node_modules/react-dnd/dist/esm/internals/DragSourceMonitorImpl.mjs 1:0-161 Module not found: Error: Can't resolve 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/ node_modules/@babel/runtime/helpers/esm/classCallCheck' in 'D:\SoftwareDocument\Webstorm\YHSystemUI_2\node_modules\r eact-dnd\dist\esm\internals' Did you mean 'classCallCheck.js'? BREAKING CHANGE: The request 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/node_modul es/@babel/runtime/helpers/esm/classCallCheck' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./node_modules/react-dnd/dist/esm/internals/index.mjs 1:0-44 1:0-44 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.mjs 2:0-59 13:28-42 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.mjs 1:0-72 19:2-25 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/index.mjs 1:0-30 1:0-30 @ ./node_modules/react-dnd/dist/esm/hooks/index.mjs 1:0-36 1:0-36 @ ./node_modules/react-dnd/dist/esm/index.mjs 3:0-34 3:0-34 @ ./src/.umi/.cache/.mfsu/mf-va_react-dnd.js 1:0-26 2:15-16 3:0-26 3:0-26 @ container entry ./react-dnd[0]

ERROR in ./node_modules/react-dnd/dist/esm/internals/DragSourceMonitorImpl.mjs 2:0-155 Module not found: Error: Can't resolve 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/ node_modules/@babel/runtime/helpers/esm/createClass' in 'D:\SoftwareDocument\Webstorm\YHSystemUI_2\node_modules\reac t-dnd\dist\esm\internals' Did you mean 'createClass.js'? BREAKING CHANGE: The request 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/node_modul es/@babel/runtime/helpers/esm/createClass' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./node_modules/react-dnd/dist/esm/internals/index.mjs 1:0-44 1:0-44 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.mjs 2:0-59 13:28-42 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.mjs 1:0-72 19:2-25 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/index.mjs 1:0-30 1:0-30 @ ./node_modules/react-dnd/dist/esm/hooks/index.mjs 1:0-36 1:0-36 @ ./node_modules/react-dnd/dist/esm/index.mjs 3:0-34 3:0-34 @ ./src/.umi/.cache/.mfsu/mf-va_react-dnd.js 1:0-26 2:15-16 3:0-26 3:0-26 @ container entry ./react-dnd[0]

ERROR in ./node_modules/react-dnd/dist/esm/internals/DropTargetMonitorImpl.mjs 1:0-161 Module not found: Error: Can't resolve 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/ node_modules/@babel/runtime/helpers/esm/classCallCheck' in 'D:\SoftwareDocument\Webstorm\YHSystemUI_2\node_modules\r eact-dnd\dist\esm\internals' Did you mean 'classCallCheck.js'? BREAKING CHANGE: The request 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/node_modul es/@babel/runtime/helpers/esm/classCallCheck' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./node_modules/react-dnd/dist/esm/internals/index.mjs 2:0-44 2:0-44 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.mjs 2:0-59 13:28-42 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.mjs 1:0-72 19:2-25 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/index.mjs 1:0-30 1:0-30 @ ./node_modules/react-dnd/dist/esm/hooks/index.mjs 1:0-36 1:0-36 @ ./node_modules/react-dnd/dist/esm/index.mjs 3:0-34 3:0-34 @ ./src/.umi/.cache/.mfsu/mf-va_react-dnd.js 1:0-26 2:15-16 3:0-26 3:0-26 @ container entry ./react-dnd[0]

ERROR in ./node_modules/react-dnd/dist/esm/internals/DropTargetMonitorImpl.mjs 2:0-155 Module not found: Error: Can't resolve 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/ node_modules/@babel/runtime/helpers/esm/createClass' in 'D:\SoftwareDocument\Webstorm\YHSystemUI_2\node_modules\reac t-dnd\dist\esm\internals' Did you mean 'createClass.js'? BREAKING CHANGE: The request 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/node_modul es/@babel/runtime/helpers/esm/createClass' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./node_modules/react-dnd/dist/esm/internals/index.mjs 2:0-44 2:0-44 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.mjs 2:0-59 13:28-42 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.mjs 1:0-72 19:2-25 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/index.mjs 1:0-30 1:0-30 @ ./node_modules/react-dnd/dist/esm/hooks/index.mjs 1:0-36 1:0-36 @ ./node_modules/react-dnd/dist/esm/index.mjs 3:0-34 3:0-34 @ ./src/.umi/.cache/.mfsu/mf-va_react-dnd.js 1:0-26 2:15-16 3:0-26 3:0-26 @ container entry ./react-dnd[0]

ERROR in ./node_modules/react-dnd/dist/esm/internals/SourceConnector.mjs 1:0-161 Module not found: Error: Can't resolve 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/ node_modules/@babel/runtime/helpers/esm/classCallCheck' in 'D:\SoftwareDocument\Webstorm\YHSystemUI_2\node_modules\r eact-dnd\dist\esm\internals' Did you mean 'classCallCheck.js'? BREAKING CHANGE: The request 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/node_modul es/@babel/runtime/helpers/esm/classCallCheck' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./node_modules/react-dnd/dist/esm/internals/index.mjs 3:0-38 3:0-38 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.mjs 2:0-59 13:28-42 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.mjs 1:0-72 19:2-25 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/index.mjs 1:0-30 1:0-30 @ ./node_modules/react-dnd/dist/esm/hooks/index.mjs 1:0-36 1:0-36 @ ./node_modules/react-dnd/dist/esm/index.mjs 3:0-34 3:0-34 @ ./src/.umi/.cache/.mfsu/mf-va_react-dnd.js 1:0-26 2:15-16 3:0-26 3:0-26 @ container entry ./react-dnd[0]

ERROR in ./node_modules/react-dnd/dist/esm/internals/SourceConnector.mjs 2:0-155 Module not found: Error: Can't resolve 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/ node_modules/@babel/runtime/helpers/esm/createClass' in 'D:\SoftwareDocument\Webstorm\YHSystemUI_2\node_modules\reac t-dnd\dist\esm\internals' Did you mean 'createClass.js'? BREAKING CHANGE: The request 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/node_modul es/@babel/runtime/helpers/esm/createClass' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./node_modules/react-dnd/dist/esm/internals/index.mjs 3:0-38 3:0-38 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.mjs 2:0-59 13:28-42 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.mjs 1:0-72 19:2-25 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/index.mjs 1:0-30 1:0-30 @ ./node_modules/react-dnd/dist/esm/hooks/index.mjs 1:0-36 1:0-36 @ ./node_modules/react-dnd/dist/esm/index.mjs 3:0-34 3:0-34 @ ./src/.umi/.cache/.mfsu/mf-va_react-dnd.js 1:0-26 2:15-16 3:0-26 3:0-26 @ container entry ./react-dnd[0]

ERROR in ./node_modules/react-dnd/dist/esm/internals/TargetConnector.mjs 1:0-161 Module not found: Error: Can't resolve 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/ node_modules/@babel/runtime/helpers/esm/classCallCheck' in 'D:\SoftwareDocument\Webstorm\YHSystemUI_2\node_modules\r eact-dnd\dist\esm\internals' Did you mean 'classCallCheck.js'? BREAKING CHANGE: The request 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/node_modul es/@babel/runtime/helpers/esm/classCallCheck' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./node_modules/react-dnd/dist/esm/internals/index.mjs 4:0-38 4:0-38 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.mjs 2:0-59 13:28-42 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.mjs 1:0-72 19:2-25 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/index.mjs 1:0-30 1:0-30 @ ./node_modules/react-dnd/dist/esm/hooks/index.mjs 1:0-36 1:0-36 @ ./node_modules/react-dnd/dist/esm/index.mjs 3:0-34 3:0-34 @ ./src/.umi/.cache/.mfsu/mf-va_react-dnd.js 1:0-26 2:15-16 3:0-26 3:0-26 @ container entry ./react-dnd[0]

ERROR in ./node_modules/react-dnd/dist/esm/internals/TargetConnector.mjs 2:0-155 Module not found: Error: Can't resolve 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/ node_modules/@babel/runtime/helpers/esm/createClass' in 'D:\SoftwareDocument\Webstorm\YHSystemUI_2\node_modules\reac t-dnd\dist\esm\internals' Did you mean 'createClass.js'? BREAKING CHANGE: The request 'D:/SoftwareDocument/Webstorm/YHSystemUI_2/node_modules/@umijs/bundler-utils/node_modul es/@babel/runtime/helpers/esm/createClass' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request. @ ./node_modules/react-dnd/dist/esm/internals/index.mjs 4:0-38 4:0-38 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useRegisteredDragSource.mjs 2:0-59 13:28-42 @ ./node_modules/react-dnd/dist/esm/hooks/useDrag/useDrag.mjs 1:0-72 19:2-25 @ ./node_modules/react-dnd/dist/esm/hooks/index.mjs 1:0-36 1:0-36 @ ./node_modules/react-dnd/dist/esm/index.mjs 3:0-34 3:0-34 @ ./src/.umi/.cache/.mfsu/mf-va_react-dnd.js 1:0-26 2:15-16 3:0-26 3:0-26 @ container entry ./react-dnd[0]

webpack compiled with 39 errors null Error: build failed at D:\AAAAA\node_modules\@umijs\bundler-webpack\lib\index.js:172:29 at D:\AAAAAA\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:114591:14
at processQueueWorker (D:\AAAAAA\node_modules\@umijs\deps\compiled\webpack\5\bun dle5.js:114529:6) at processTicksAndRejections (node:internal/process/task_queues:78:11)

🚑 其他信息

chenshuai2144 commented 2 years ago

看起来是因为这个库用了 mjs 导致的,去umi问问?

vcing commented 2 years ago

请问解决了吗? 我也碰到一模一样的问题了

DearVikki commented 2 years ago

这个库 package.json 申明的是 "type": "module",试试看把 import from 改成 require 的形式

sogud commented 2 years ago

你应该是开启了mfsu,关了就好了 umi的bug,如果开启mfsu可以配置nodeModulesTransform type: 'none',