Skip to content Skip to sidebar Skip to footer

Angular 8 Webpack Aot Build Failed - Cannot Read Property 'map' Of Undefined

error message is html-webpack-plugin error this error comes up only when bundling for production application bundles correctly when @ngtools/webpack is replaced with angular-route

Solution 1:

In my case, an error very similar to this one was occurring, because I had declared the CopyWebpackPlugin as this:

new CopyWebpackPlugin([{
  patterns: [{
     ...
  }]
}])

Instead of this:

new CopyWebpackPlugin({
  patterns: [{
     ...
  }]
})

Those extra brackets were the problem.

Solution 2:

I got a similar error when I migrated from webpack@3 to a new version. In my case, it was ERROR in Cannot read property 'name' of undefined while I was trying to run npm run build in my React project.

The problem was caused by webpack-parallel-uglify-plugin which is deprecated in webpack@4 configuration and used as a default in production mode. Here is the doc: https://webpack.js.org/migrate/4/#deprecatedremoved-plugins

The solution was to remove:

new ParallelUglifyPlugin({})

initialization from webpack.config.js

GL HF :)

Post a Comment for "Angular 8 Webpack Aot Build Failed - Cannot Read Property 'map' Of Undefined"