javascript - 我将 webpack v4 升级到 v5,之后出现 "cannot add property"错误

标签 javascript webpack html-webpack-plugin webpack-5

我根据此文档将我的 webpack v4 升级到 v5 https://webpack.js.org/migrate/5之后我收到此错误。

TypeError: Cannot add property htmlWebpackPluginAlterChunks, object is not extensible
    at /home/ec2-user/abhisar/insights-master/frontend/node_modules/html-webpack-plugin/index.js:59:56
    at Hook.eval [as call] (eval at create (/home/ec2-user/abhisar/insights-master/frontend/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:100:1)
    at Hook.CALL_DELEGATE [as _call] (/home/ec2-user/abhisar/insights-master/frontend/node_modules/webpack/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/home/ec2-user/abhisar/insights-master/frontend/node_modules/webpack/lib/Compil
我能做些什么来解决这个问题?
Error I get is related to html-webpack-plugin

最佳答案

我知道这个答案有点晚了,但我最近遇到了同样的问题。我能够通过将我的 html-webpack-plugin 版本更新到 v5.3.2 来解决它(截至撰写本文时的最新版本)。我正在使用 Node/NPM,所以对于我的解决方案,我只是更改了 package.json 文件中的版本号,然后运行 ​​npm install

关于javascript - 我将 webpack v4 升级到 v5,之后出现 "cannot add property"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68302157/

相关文章:

windows - 适用于 Windows 的 Docker : corrupted files

webpack - html-webpack-plugin 不适用于 webpack-dev-server

javascript - javascript 中的上下文

javascript - 航点删除类

javascript - $http JSON 请求在 angularjs 中不起作用

javascript - WebPack如何将所有的css文件放到一个css文件中

javascript - react-pdf 安装时的 webpack 插件错误

javascript - Deezer Javascript SDK playAlbum 自动播放标志在 Android 上被忽略

angular - 使用angular-cli在angular2前端构建错误

javascript - 使用 webpack、ES6 和 Babel 进行调试