I upgraded my webpack v4 to v5 and after that I am getting a "cannot add property" error
Asked Answered
T

1

13

I upgraded my webpack v4 to v5 as per this docs https://webpack.js.org/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?

Error I get is related to html-webpack-plugin

Ted answered 8/7, 2021 at 13:1 Comment(1)
What is the version of html-webpack-plugin?Twelvetone
D
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

Dyscrasia answered 8/8, 2021 at 13:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.