Skip to content

Lazy loading not working #304

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
nileshpatil-dev opened this issue Apr 8, 2018 · 3 comments
Closed

Lazy loading not working #304

nileshpatil-dev opened this issue Apr 8, 2018 · 3 comments
Labels

Comments

@nileshpatil-dev
Copy link

facing below issue after implementing lazy loading.
capture

@sinedied
Copy link
Member

sinedied commented Apr 9, 2018

@nileshpatilwork Please follow the issue template so we can help you, we need a bit more context such as OS, version etc as in the template.

Seems related to angular/angular-cli#9775

@nileshpatil-dev
Copy link
Author

I am using Windows 7, Angular 5.2.5, ngx-generator 4.1.0
I can see about.module.chunk.js loaded initially when app loaded. Please check below image.
capture

@sinedied
Copy link
Member

That's not a bug, that's by design look at app-routing.module.ts:

  imports: [RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })],

The default strategy is to preload all modules, so get the best of both worlds:

  • Only the needed modules are first loaded to ensure fast initial screen display
  • Remaining modules are then preloaded so later navigation is faster

You can change this behavior or implement your own if needed, see https://medium.com/@adrianfaciu/custom-preloading-strategy-for-angular-modules-b3b5c873681a for more details.

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

No branches or pull requests

2 participants