angular-cli AOT lazy load issue
See original GitHub issueThe angular ahead of time (AOT) compiler fails when a module does
import * as moment from 'moment';
See this ticket: https://github.com/angular/angular-cli/issues/2496 and similar ones. What basically happens is that as soon as there is an import on moment somewhere, generation of bundles for lazily loaded routes fail.
This package is one that breaks AOT lazy loading.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Lazy-loading with new import syntax throws in AoT ... - GitHub
The issue is that latest release of Angular CLI updates all the old string-typed loadChildren when you run ng update so we need...
Read more >Angular Lazy Loading in aot / prod mode - Stack Overflow
Angular CLI only supports lazy route detection via the loadChildren string syntax, while the repro uses a function instead. Since the lazy route ......
Read more >Pillar 3 — Lazy Loading, AOT, and Preloading - Angular inDepth
Lazy loading is a useful technique for faster initial page loads. With lazy loading, your application loads faster by shipping only the essential...
Read more >Hello World With The CLI, AoT, Lazy Loading Routes ...
Features like "differential loading" and the Ivy renderer require more than a few configuration tweaks. As such, I've decided to stop fighting ...
Read more >Lazy-loading feature modules - Angular
Setting up a lazy-loaded feature module requires two main steps: Create the feature module with the Angular CLI, using the --route flag. Configure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Workaround for
import * as moment
which uses 50kb is to use a modular library like date-fns instead (28.7kb for me): https://github.com/angular/angular-cli/issues/2496#issuecomment-274272747Version 2.0.0 should fix this. Note that the package is now called
ngx-moment
instead ofangular2-moment
. Please open a new issue if this still happens.