angular2-webpack2-lazy-children-loader

1.0.1 • Public • Published

Angular2 load-children loader

This is a webpack loader to Angular2 lazy module loading.

It's recommended to use this loader with webpack 2.x.

  • INPUT:
export const appRoutes: Routes = [
  {path: "", component: MainHomeComponent},
  {path: "about", component: MainAboutComponent },
  {path: "sub", loadChildren: "./sub.module#SubModule" },
];
  • OUTPUT:
export const appRoutes: Routes = [
  {path: "", component: MainHomeComponent},
  {path: "about", component: MainAboutComponent },
  {path: "sub", loadChildren: () => System.import("./sub.module").then(m => m["SubModule"]) },
];

And this loader return a function to call the require function with .ngfactory suffix if the resource is generated by compiler-cli:

export const appRoutes: Routes = [
  {path: "", component: MainHomeComponent},
  {path: "about", component: MainAboutComponent },
  {path: "sub", loadChildren: () => System.import("./sub.module.ngfactory").then(m => m["SubModuleNgFactory"]) },
];

Install

npm install angular2-webpack2-lazy-children-loader -D
npm install @types/node -D

or

typings install node

Notice

Fork of angular2-load-children-loader

License

MIT

Package Sidebar

Install

npm i angular2-webpack2-lazy-children-loader

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • tomastrajan