webpack chunk.js引发异常

时间:2018-09-27 15:27:41

标签: javascript node.js npm webpack

我目前正在尝试使webpack可以用于我的项目。首先,我正在使用以下存储库:https://github.com/fstanis/webextensions-webpack-boilerplate

这是一个很好的起点,但是将其集成到我的代码中后,我遇到了问题。需要对extract-loader软件包进行更新,以与Bootstrap的CSS一起使用。在更新此程序包时,我意识到基本上所有的程序包都有相当多的版本。

因此,我删除了package-lock.json,然后重新安装了软件包。完成此操作后,webpack崩溃。

重现该问题:

  • 克隆存储库:git clone https://github.com/fstanis/webextensions-webpack-boilerplate
  • 删除package-lock.json和package.json
  • 添加我的新package.json(请参见下文)
  • npm install
  • webpacknpm run start

这是更新的package.json。请注意:此文件应包含完全相同的软件包。今天只需安装,其当前版本为:

{
  "name": "webextensions-webpack-boilerplate",
  "version": "0.1.0",
  "description": "A boilerplate for creating a browser extension with webpack",
  "license": "0BSD",
  "repository": {
    "type": "git",
    "url": "https://github.com/fstanis/webextensions-webpack-boilerplate.git"
  },
  "scripts": {
    "start": "webpack --config webpack.config.js"
  },
  "//": "[TODO] Remove webpack-sources when this is fixed: https://github.com/webpack/webpack-sources/issues/28",
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^8.0.2",
    "babel-minify-webpack-plugin": "^0.3.1",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "clean-webpack-plugin": "^0.1.19",
    "css-loader": "^1.0.0",
    "extract-loader": "^3.0.0",
    "extract-text-webpack-plugin": "^3.0.2",
    "extricate-loader": "^3.0.0",
    "file-loader": "^2.0.0",
    "html-loader": "^0.5.5",
    "imports-loader": "^0.8.0",
    "interpolate-loader": "^2.0.0",
    "prop-loader": "^1.0.0",
    "raw-loader": "^0.5.1",
    "spawn-loader": "^6.0.0",
    "webextension-polyfill": "^0.3.1",
    "webpack": "^4.20.2",
    "webpack-cli": "^3.1.1",
    "webpack-sources": "^1.3.0"
  }
}

运行webpack产生的错误消息是:

npm run start

> webextensions-webpack-boilerplate@0.1.0 start /home/lhk/programming/temp/webextensions-webpack-boilerplate
> webpack --config webpack.config.js

clean-webpack-plugin: /home/lhk/programming/temp/webextensions-webpack-boilerplate/dist has been removed.
(node:29503) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
/home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/webpack/lib/Chunk.js:827
                throw new Error(
                ^

Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead
    at Chunk.get (/home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/webpack/lib/Chunk.js:827:9)
    at /home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/extract-text-webpack-plugin/dist/index.js:176:48
    at Array.forEach (<anonymous>)
    at /home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/extract-text-webpack-plugin/dist/index.js:171:18
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (/home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.seal (/home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/webpack/lib/Compilation.js:1215:27)
    at hooks.make.callAsync.err (/home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/webpack/lib/Compiler.js:541:17)
    at _err0 (eval at create (/home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:11:1)
    at _addModuleChain (/home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/webpack/lib/Compilation.js:1066:12)
    at processModuleDependencies.err (/home/lhk/programming/temp/webextensions-webpack-boilerplate/node_modules/webpack/lib/Compilation.js:982:9)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webextensions-webpack-boilerplate@0.1.0 start: `webpack --config webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webextensions-webpack-boilerplate@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/lhk/.npm/_logs/2018-09-27T15_20_57_639Z-debug.log

0 个答案:

没有答案