10

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

halfer
  • 19,824
  • 17
  • 99
  • 186
Abhisar Tripathi
  • 1,569
  • 10
  • 21

1 Answers1

20

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

sog
  • 493
  • 4
  • 13