question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

angular-cli AOT lazy load issue

See original GitHub issue

The 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:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
intellixcommented, Jan 21, 2017

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-274272747

0reactions
urishcommented, Apr 17, 2018

Version 2.0.0 should fix this. Note that the package is now called ngx-moment instead of angular2-moment. Please open a new issue if this still happens.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found