Lazy Ninjas is a simple NativeScript-Angular application, demonstrating several implementations of lazy loaded modules. Please check out the Optimizing app loading time with Angular Lazy Loading article.
Start by cloning the repo:
$ git clone https://github.com/sis0k0/lazyNinjas.git
$ cd lazyNinjas
Then, install the NativeScript CLI:
npm i -g nativescript
Now, you can use the preview
command to build and start the app:
$ tns preview
If you want to bundle the app with webpack, append the --bundle
flag:
$ tns preview --bundle
-
The aot branch shows how to use a single lazy module.
-
The nested-lazy-modules branch shows how to set up a module hierarchy with nested lazily loaded NgModules.
-
The callback-loading branch shows how to lazy load modules by passing a callback function to the
loadChildren
properties in the router configuration. -
The custom-module-loader branch shows how to extract the loading logic to a custom module loader.