我的 React 测试脚本遇到了一个小问题,我最终使用以下命令升级了我的 npm
npm upgrade -g
我认为这不仅升级了 npm
(到 5.3.0),还升级了 webpack
(到 3.4.1)、extract-text-webpack-plugin
(到 3.0.0)以及每个 npm
包。
理想情况下,这应该可以解决所有问题,但我收到以下错误
使用 webpack
构建我的代码时:
C:\Users\xxx\Google Drive\sites\trip\jsbuild>webpack -d --display-error-details
C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Chunk.js:49
throw new Error("Chunk.entry was removed. Use hasRuntime()");
^
Error: Chunk.entry was removed. Use hasRuntime()
at Chunk.entry (C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Chunk.js:49:9)
at C:\Users\xxx\AppData\Roaming\npm\node_modules\extract-text-webpack-plugin\index.js:201:13
at Array.filter (native)
at Compilation.<anonymous> (C:\Users\xxx\AppData\Roaming\npm\node_modules\extract-text-webpack-plugin\index.js:200:37)
at Compilation.applyPlugins0 (C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\node_modules\tapable\lib\Tapable.js:68:14)
at Compilation.seal (C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Compilation.js:567:8)
at C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Compiler.js:514:17
at C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\node_modules\tapable\lib\Tapable.js:289:11
at C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Compilation.js:481:11
at C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Compilation.js:452:13
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
<小时/>
在谷歌上找不到任何解决方案...... 如果有人能指出我正确的方向,那就太好了......
最佳答案
升级之前您使用的是哪个版本的 webpack? webpack 1 和 2/3 之间存在显着的配置差异。
我建议暂时将 webpack 回滚到之前的版本。了解如何迁移 webpack 配置文件,然后迁移。
关于node.js - npm 升级后 Webpack 未构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45550295/