Inspired by https://medium.com/@var_bin/angularjs-webpack-lazyload-bb7977f390dd
but using wepback import() function
Working with:
- @uirouter/angularjs: 1.0.22
- @uirouter/core: 5.0.23
- angular: 1.4.9
- webpack: 4.39.1
- webpack-cli: 3.3.6
See also:
Inspired by https://medium.com/@var_bin/angularjs-webpack-lazyload-bb7977f390dd
but using wepback import() function
Working with:
See also:
| import * as angular from 'angular'; | |
| export default angular | |
| .module('demo', [ | |
| ]) | |
| .config([ | |
| '$stateProvider', | |
| function($stateProvider) { | |
| $stateProvider | |
| .state('demo.**', { | |
| url: '/demo', | |
| lazyLoad: () => import(/* webpackChunkName: "demo" */ './demo.states').then(({ default: lazyLoadResults }) => lazyLoadResults), | |
| }) | |
| ; | |
| }, | |
| ]) | |
| .name | |
| ; |
| export default { | |
| states: [ | |
| { | |
| name: 'my-page', | |
| url: '/demo/my-page', | |
| templateUrl: 'demo/my-page.html', | |
| controller: () => { | |
| //something in it | |
| }, | |
| }, | |
| ], | |
| }; | |
| { | |
| "compilerOptions": { | |
| "target": "es5", | |
| "moduleResolution": "node", | |
| "module": "esnext", | |
| "importHelpers": true | |
| } | |
| } |