michaeldoye / mat-progress-buttons

Very simple Angular6+ Material Design progress buttons
https://mat-progress-buttons.firebaseapp.com/
MIT License
110 stars 54 forks source link

BrowserModule error with lazy module in prod #9

Closed chunghha closed 6 years ago

chunghha commented 6 years ago

ERROR Error: Uncaught (in promise): Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.

As mentioned in one of comments in #7, I can confirm that this browser module error appears with lazy modules run time of prod build (--aot --prod) and I thought that deserves a separate issue so here it is.

I also can confirm that I don't see the error with default cli build (without --prod). And, another note is that even I copied exact same code of this package to my own private package built with angular cli library creation, I don't see the error with --prod. So I am thinking this issue may come from the rollup build, but just a guess.

michaeldoye commented 6 years ago

Thanks for the report, I will be releasing a new version soon with a new build process which fixes this issue. Will ping you here when it is released.

michaeldoye commented 6 years ago

fixed in 7.0.4

danieldgt commented 5 years ago

I had the same problem when the module that used this component was loaded. Works fine with mat-progress-buttons version: "8.0.3" and Angular CLI: 1.7.4 Node: 9.2.1 OS: darwin x64 Angular: 5.2.11 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router

@angular/cdk: 5.2.5 @angular/cli: 1.7.4 @angular/material-moment-adapter: 6.4.7 @angular/material: 5.2.5 @angular-devkit/build-optimizer: 0.3.2 @angular-devkit/core: 0.3.2 @angular-devkit/schematics: 0.3.2 @ngtools/json-schema: 1.2.0 @ngtools/webpack: 1.10.2 @schematics/angular: 0.3.2 @schematics/package-update: 0.3.2 typescript: 2.9.2 webpack: 3.11.0

this error was resolved

ERROR Error: Uncaught (in promise): Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead. Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.