ProgressPlugin TypeError:无法读取未定义的属性“ tap”

时间:2018-11-09 14:42:05

标签: webpack

编译时出现错误。对于webpack中的ProgressPlugin似乎不满意:

/node_modules/webpack/lib/ProgressPlugin.js:205
    compilation.hooks.addEntry.tap("ProgressPlugin", entryAdd);

TypeError: Cannot read property 'tap' of undefined

我知道webpack 4的插件最近进行了一些更改。看来addEntry, failedEntry, succeedEntry不在编译挂钩的文档中-https://webpack.js.org/api/compilation-hooks/-我是否缺少某些内容?

我的package.json deps:

"amazon-cognito-identity-js": "^2.0.30",
"array-move": "^1.0.0",
"aws-sdk": "^2.352.0",
"babel-loader": "^8.0.4",
"babel-plugin-styled-components": "^1.8.0",
"fuse.js": "^3.3.0",
"grid-styled": "^5.0.2",
"json-cycle": "^1.3.0",
"lodash": "^4.17.11",
"next": "^7.0.2",
"next-routes": "^1.4.2",
"node-fetch": "^2.2.1",
"path-match": "1.2.4",
"rc-time-picker": "^3.4.0",
"react": "^16.6.1",
"react-autocomplete": "^1.8.1",
"react-copy-to-clipboard": "^5.0.1",
"react-day-picker": "^7.2.4",
"react-dom": "^16.6.1",
"react-modal": "^3.6.1",
"react-places-autocomplete": "^6.1.3",
"react-scripts": "^1.1.5",
"react-spinners": "^0.4.7",
"react-stripe-checkout": "^2.6.3",
"react-stripe-elements": "^2.0.1",
"refunk": "^3.0.1",
"styled-system-html": "^2.0.2",
"webpack": "^4.25.1",
"webpack-dev-server": "^3.1.10"

3 个答案:

答案 0 :(得分:4)

您有2个不同版本的webpack,您安装的版本导致其崩溃。

不要自行安装webpack,因为它已经安装了next。

答案 1 :(得分:0)

在我的情况下,错误是我将插件放在resolve.plugins下,而不是直接在webpack配置中的plugins下。来自https://github.com/webpack/webpack/issues/8548#issuecomment-449829774

的解决方案

答案 2 :(得分:-1)

这是因为不同的 webpack。 尝试运行此命令。

npm install --save-dev webpack@4.44.0