Skip to content

ng2-bootstrap breaks lazy loading (angular-cli) #1187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
slubowsky opened this issue Oct 31, 2016 · 1 comment
Closed

ng2-bootstrap breaks lazy loading (angular-cli) #1187

slubowsky opened this issue Oct 31, 2016 · 1 comment

Comments

@slubowsky
Copy link

slubowsky commented Oct 31, 2016

Have an angular-cli app that has lazy loading working. Add an alert to it as described in readme https://github.com/valor-software/ng2-bootstrap/blob/development/docs/getting-started/ng-cli.md. Lazy loading stops working. Only one bundle is created.

(To verify its not my app, I found another cli lazy loading app at angular/angular-cli#2865. Downloaded NotLazyLoading.zip from that issue, fixed the typo in app-routing.module.ts as described there, verified lazy loading works. Added ng2-bootstrap as above, now only 1 bundle created)

See also angular/angular-cli#2967

@slubowsky
Copy link
Author

slubowsky commented Nov 1, 2016

Looks like this is an angular-cli issue. See angular/angular-cli#2496 (comment) having import * as moment in your code or any imported library currently breaks lazy loading. ng2-bootstrap has this for datepicker module.
Workaround for all but date picker is to import individual modules only e.g. import { AlertModule } from 'ng2-bootstrap/components/alert'; instead of import { AlertModule } from 'ng2-bootstrap/ng2-bootstrap';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant