lmeijdam / angular-umd-dynamic-example

Angular UMD example of loading new modules dynamically
174 stars 57 forks source link

Modules not loading when building with --prod #12

Closed paramoca closed 5 years ago

paramoca commented 5 years ago

Hi,

It might be related to: it can't run in production mode. #8 but I am getting the issue.

I am building the app using the following command: ng build --prod, and it build Ok but when I am trying to load any module, for instance the modulea, I am getting this error:

ERROR Error: Uncaught (in promise): Error: Unexpected value 'TD' imported by the module 'ModuleaModule'. Please add a @NgModule annotation. Error: Unexpected value 'TD' imported by the module 'ModuleaModule'. Please add a @NgModule annotation.

When building without the --prod, the app loads any module and works as expected but the optimization is not happening and the file (vendor.js) size is big.

Do I need to add any param when building the app? other than --prod.

Thanks

lmeijdam commented 5 years ago

Hey

Can you try with ; ng build --prod --aot --build-optimizer=false Other info can be found #1

paramoca commented 5 years ago

Hey,

The #1 pointed me to the right direction. I am working with angular 7.2.0, and as it was explained in the #1 a polyfills must be included to be able to load the module.

Now, I guess the standing question it is related to how to use the build-optimizer to reduce my app size because I'm working with third party library part of my external modules.

Thanks for your help, and for the repo.

I will close the issue.

paramoca commented 5 years ago

The #1 answer the question, and the same finding that is not resolved related to the build-optimizer.

jaichandra commented 4 years ago

Any idea how to get build-optimizer working with this? My build size is over the limits with build-optimizer set to false.