Reputation: 3545
I just noticed that for Angular 7, if I am building the project with this:
ng build --aot
, then all fine, and it will generate all the lazy loaded modules separately, but if I use this: ng build --prod
, then the lazy loaded module is NOT generated at all under dist
folder.
I checked the doc, they said using --lazyModules
options, but I tried a lot by passing the lazy module as its value like below:
ng build --aot --progress=true --optimization=true --lazyModules=modules/home/home.module
it is useless and give me error as below:
ERROR in ./$$_lazy_route_resource lazy namespace object Module not found: Error: Can't resolve '/Users/projects/projectname/source/projectnamesrc/app/modules/modules/home/home.module.ngfactory.js' in '/Users/projects/projectname/source/projectname/$$_lazy_route_resource'
So if I am using lazyloading, can I still use --prod
parameter?
Thanks
Upvotes: 1
Views: 554
Reputation: 300
ng build --base-href /ProjectName/ --prod --build-optimizer --vendor-chunk
Upvotes: 1