0

I have a angular 7 application, where i created multiple modules. Now when i build using ng build, it builds and creates js files inside the dist folder like scripts.js vendor.js and also for each module in the app it creates like the below

my-profile-my-profile-module.js.map

my-profile-my-profile-module.js

service-reports-module.js.map

service-reports-module.js

...

My question is this normal or there has to be only two files i.e scripts.js and vendor.js inside dist folder

I have tried ng build --prod , it still creates the same files except the size reduction of the files

  • check here https://stackoverflow.com/questions/42118760/what-are-the-map-files-used-for-in-angular-cli-and-can-ng-build-not-create-thes – d00lar Aug 22 '19 at 06:39
  • This is perfectly normal and this is the expected output. You get a js file for each module when you have lazy-loading. –  Aug 22 '19 at 06:40
  • thanks for the reply. my question is not about .map files, will ng build create js files for modules too? –  Aug 22 '19 at 06:41
  • @Arul ok, thanks, but how to avoid generating multiple files? any ways to edit the webpack file etc ? –  Aug 22 '19 at 06:47
  • When you have configured Lazy-loading, you will get separate files for each module. When you disable lazy-loading and use eager loading, you will get single file for all modules. Why do you want to have single file? –  Aug 22 '19 at 06:52

0 Answers0