Angular-cli: I'm not able to lazy load module with angular cli project.

Created on 25 Jan 2017  路  3Comments  路  Source: angular/angular-cli

I search how I can use lazy load module on an angular cli project. On the angular router page, I see this information :

Angular provides a built-in module loader that supports SystemJS to load modules asynchronously. If you were using another bundling tool, such as Webpack, you would use the Webpack mechanism for asynchronously loading modules.

I tried many things but in angular cli project, i'm not able to do working. Do you have an example or a documentation link to enable this feature.

Thanks

Thanks

I use angular cli version 1.0.0.BETA-24

Most helpful comment

Check this example:

https://github.com/meligy/routing-angular-cli

Let's imagine we have the route lazy, and we want to lazy load it, we create a route entry that looks like this:

  { path: 'lazy', loadChildren: './lazy/lazy.module#LazyModule' }

You might need to restart ng serve for this to work, but you should find an extra bundle file generated, and the child bundles in the LazyModule should just work.

All 3 comments

Check this example:

https://github.com/meligy/routing-angular-cli

Let's imagine we have the route lazy, and we want to lazy load it, we create a route entry that looks like this:

  { path: 'lazy', loadChildren: './lazy/lazy.module#LazyModule' }

You might need to restart ng serve for this to work, but you should find an extra bundle file generated, and the child bundles in the LazyModule should just work.

Closing as answered.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jmurphzyo picture jmurphzyo  路  3Comments

hartjo picture hartjo  路  3Comments

donaldallen picture donaldallen  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments