compilation.errors.push(new webpack_1.WebpackError(message))

Viewed 217

After upgrade to Angular12 facing an issue like compilation.errors.push(new webpack_1.WebpackError(message)); Inside node_modules@ngtools\webpack\src\webpack-diagnostics.js:17 TypeError: webpack_1.WebpackError is not a constructor at Object.addError (\node_modules@ngtools\webpack\src\webpack-diagnostics.js:17:29)) at \node_modules@ngtools\webpack\src\ivy\diagnostics.js:19:39 at AngularWebpackPlugin.updateAotProgram(\node_modules@ngtools\webpack\src\ivy\plugin.js:342:17)

1 Answers

I had the same issue and found out that the peer dependency of webpack@^5.0.0 was missing when running "npm list".

I fixed it by adding webpack to my project: https://www.npmjs.com/package/webpack

Related