angularangular-cliangular8angular-cli-v8

angular cli duplicate chunk name after ng build


I'm developing Angular v8 app with using Angular CLI v8.

I have dashboard.module.ts

And after executing command ng-build I see in dist folder files with names:

dashboard-dashboard-module.js

Why not dashboard-module.js?

Why it's duplicate dashboard-dashboard?

What's the reason of naming it such way? Or it's default behavior?


Solution

  • The name of your chunk is built following this pattern: {ModuleDirectoryName}-{ModuleName}.js

    So if your module path looks like dashboard/dashboard.module.ts, the built chunk will be named dashboard-dashboard-module.js

    If you want to change the naming pattern, one possibility is to use the webpack Plugin angular-named-lazy-chunks-webpack-plugin.