All Projects → brandonroberts → Angular Router Loader

brandonroberts / Angular Router Loader

A Webpack loader that enables string-based module loading with the Angular Router

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Angular Router Loader

Ng Router Loader
Webpack loader for NgModule lazy loading using the angular router
Stars: ✭ 47 (-75.77%)
Mutual labels:  webpack, webpack-loader, router
Style Loader
Style Loader
Stars: ✭ 1,572 (+710.31%)
Mutual labels:  webpack, webpack-loader
Sass Vars Loader
Use Sass variables defined in Webpack config or in external Javascript or JSON files
Stars: ✭ 112 (-42.27%)
Mutual labels:  webpack, webpack-loader
Svg Sprite Loader
Webpack loader for creating SVG sprites.
Stars: ✭ 1,822 (+839.18%)
Mutual labels:  webpack, webpack-loader
Webpack Core Usage
webpack2完整系列课程,欢迎阅读。同时欢迎移步我的react全家桶文章全集: https://github.com/liangklfangl/react-article-bucket
Stars: ✭ 94 (-51.55%)
Mutual labels:  webpack, webpack-loader
Vue Svg Inline Loader
Webpack loader used for inline replacement of SVG images with actual content of SVG files in Vue projects.
Stars: ✭ 105 (-45.88%)
Mutual labels:  webpack, webpack-loader
React Redux Bootstrap Webpack Starter
React 16.9 + Typescript + React-Router 4 + Redux + Bootstrap 4 + Hot Reload + redux-devtools-extension + Webpack 4 + styled-components STARTER
Stars: ✭ 133 (-31.44%)
Mutual labels:  webpack, router
Graphql Import Loader
Webpack loader for `graphql-import`
Stars: ✭ 84 (-56.7%)
Mutual labels:  webpack, webpack-loader
File Loader
File Loader
Stars: ✭ 1,846 (+851.55%)
Mutual labels:  webpack, webpack-loader
Webpack.js.org
Repository for webpack documentation and more!
Stars: ✭ 2,049 (+956.19%)
Mutual labels:  webpack, webpack-loader
Pug As Jsx Loader
Stars: ✭ 168 (-13.4%)
Mutual labels:  webpack, webpack-loader
Webpack Conditional Loader
C conditionals directive for JavaScript
Stars: ✭ 93 (-52.06%)
Mutual labels:  webpack, webpack-loader
Css Modules Flow Types
Creates flow type definitions from CSS Modules files using Webpack loader or CLI 👾
Stars: ✭ 92 (-52.58%)
Mutual labels:  webpack, webpack-loader
Webpack Tools
☕️Just a simple webpack sample project.
Stars: ✭ 106 (-45.36%)
Mutual labels:  webpack, webpack-loader
Ignore Loader
Webpack loader to ignore certain package on build.
Stars: ✭ 85 (-56.19%)
Mutual labels:  webpack, webpack-loader
React Redux Graphql Apollo Bootstrap Webpack Starter
react js + redux + graphQL + Apollo + react router + hot reload + devTools + bootstrap + webpack starter
Stars: ✭ 127 (-34.54%)
Mutual labels:  webpack, router
Css Modules Typescript Loader
Webpack loader to create TypeScript declarations for CSS Modules
Stars: ✭ 172 (-11.34%)
Mutual labels:  webpack, webpack-loader
Sketch Loader
Webpack loader for Sketch (+43) files
Stars: ✭ 69 (-64.43%)
Mutual labels:  webpack, webpack-loader
Vue Md Loader
✨ Markdown files to ALIVE Vue components.
Stars: ✭ 78 (-59.79%)
Mutual labels:  webpack, webpack-loader
Bs Loader
📻 Bucklescript loader for Webpack and Jest
Stars: ✭ 146 (-24.74%)
Mutual labels:  webpack, webpack-loader

angular-router-loader

CircleCI npm version

A Webpack loader for Angular that enables string-based module loading with the Angular Router

Package was previously named angular2-router-loader

Installation

npm install angular-router-loader --save-dev

Usage

Add the angular-router-loader to your typescript loaders

Angular Version >= 5

loaders: [
  {
    test: /\.ts$/,
    loaders: [
      'awesome-typescript-loader'
    ]
  },
  {
    test: /\.(ts|js)$/,
    loaders: [
      'angular-router-loader'
    ]
  }  
]

Angular Version < 5

loaders: [
  {
    test: /\.ts$/,
    loaders: [
      'awesome-typescript-loader',
      'angular-router-loader'
    ]
  }  
]

Lazy Loading

In your route configuration, use loadChildren with a relative path to your lazy loaded angular module. The string is delimited with a # where the right side of split is the angular module class name.

import { Routes } from '@angular/router';

export const routes: Routes = [
  { path: 'lazy', loadChildren: './lazy.module#LazyModule' }
];

NOTE: When specifying a relative path to lazy loaded module, one of the following two conditions must hold:

  • The routes are defined in the same module file where it is imported with RouterModule.forRoot or RouterModule.forChild
  • The routes are defined in a separate routing file, and that routing file is a sibling of module file.

Synchronous Loading

For synchronous module loading, add the sync=true as a query string value to your loadChildren string. The module will be included in your bundle and not lazy-loaded.

import { Routes } from '@angular/router';

export const routes: Routes = [
  { path: 'lazy', loadChildren: './lazy.module#LazyModule?sync=true' }
];

Additional Documentation

Credits

This loader was inspired by the following projects.

es6-promise-loader by PatrickJS

angular2-template-loader by Sean Larkin

License

MIT (http://www.opensource.org/licenses/mit-license.php)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].