最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - I upgraded my webpack v4 to v5 and after that I am getting a "cannot add property" error - Stack

programmeradmin8浏览0评论

I upgraded my webpack v4 to v5 as per this docs and after that I am getting this error.

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

What can I do to resolve this?

I upgraded my webpack v4 to v5 as per this docs https://webpack.js/migrate/5 and after that I am getting this error.

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

What can I do to resolve this?

Share Improve this question edited Jul 19, 2021 at 18:55 halfer 20.4k19 gold badges108 silver badges201 bronze badges asked Jul 8, 2021 at 13:01 Abhisar TripathiAbhisar Tripathi 1,6591 gold badge12 silver badges21 bronze badges 1
  • What is the version of html-webpack-plugin? – tmhao2005 Commented Jul 9, 2021 at 4:30
Add a ment  | 

1 Answer 1

Reset to default 22

I know this answer is a little late but I had the same issue recently. I was able to resolve it by updating my version of html-webpack-plugin to v5.3.2 (lastest as of this writing). I am using Node/NPM so for my solution I just changed the version number in my package.json file and then ran npm install

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论