Skip to content

Commit 721ec9c

Browse files
docs(lazyLoad): remove all references to System.import() in favor of import()
1 parent cfc194d commit 721ec9c

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

src/lazyLoad/lazyLoadNgModule.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { applyModuleConfig } from '../uiRouterConfig';
2323
* #### Example:
2424
* ```js
2525
* export function loadFooModule() {
26-
* return System.import('../foo/foo.module').then(result => result.FooModule);
26+
* return import('../foo/foo.module').then(result => result.FooModule);
2727
* }
2828
* ```
2929
*/
@@ -49,13 +49,13 @@ export type NgModuleToLoad = string | ModuleTypeCallback;
4949
* It could also be used manually as a [[StateDeclaration.lazyLoad]] property to lazy load an `NgModule` and its state(s).
5050
*
5151
* #### Example:
52-
* Using `System.import()` and named export of `HomeModule`
52+
* Using `import()` and named export of `HomeModule`
5353
* ```js
5454
* declare var System;
5555
* var futureState = {
5656
* name: 'home.**',
5757
* url: '/home',
58-
* lazyLoad: loadNgModule(() => System.import('./home/home.module').then(result => result.HomeModule))
58+
* lazyLoad: loadNgModule(() => import('./home/home.module').then(result => result.HomeModule))
5959
* }
6060
* ```
6161
*
@@ -118,7 +118,8 @@ export function loadModuleFactory(moduleToLoad: NgModuleToLoad, ng2Injector: Inj
118118

119119
const unwrapEsModuleDefault = x => (x && x.__esModule && x['default'] ? x['default'] : x);
120120

121-
return Promise.resolve(moduleToLoad()).then(unwrapEsModuleDefault)
121+
return Promise.resolve(moduleToLoad())
122+
.then(unwrapEsModuleDefault)
122123
.then((t: NgModuleFactory<any> | Type<any>) => {
123124
if (t instanceof NgModuleFactory) {
124125
return t;

src/statebuilders/lazyLoad.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ import { loadNgModule } from '../lazyLoad/lazyLoadNgModule';
1717
* A state that has a `ngModule`
1818
* ```js
1919
* var decl = {
20-
* ngModule: () => System.import('./childModule.ts')
20+
* ngModule: () => import('./childModule.ts')
2121
* }
2222
* ```
2323
* would build a state with a `lazyLoad` function like:
2424
* ```js
2525
* import { loadNgModule } from "@uirouter/angular";
2626
* var decl = {
27-
* lazyLoad: loadNgModule(() => System.import('./childModule.ts')
27+
* lazyLoad: loadNgModule(() => import('./childModule.ts')
2828
* }
2929
* ```
3030
*
@@ -33,16 +33,16 @@ import { loadNgModule } from '../lazyLoad/lazyLoadNgModule';
3333
* #### Example:
3434
* ```js
3535
* var decl = {
36-
* lazyLoad: () => System.import('third-party-library'),
37-
* ngModule: () => System.import('./childModule.ts')
36+
* lazyLoad: () => import('third-party-library'),
37+
* ngModule: () => import('./childModule.ts')
3838
* }
3939
* ```
4040
* would build a state with a `lazyLoad` function like:
4141
* ```js
4242
* import { loadNgModule } from "@uirouter/angular";
4343
* var decl = {
44-
* lazyLoad: () => System.import('third-party-library')
45-
* .then(() => loadNgModule(() => System.import('./childModule.ts'))
44+
* lazyLoad: () => import('third-party-library')
45+
* .then(() => loadNgModule(() => import('./childModule.ts'))
4646
* }
4747
* ```
4848
*

test/ngModule/lazyModule.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ declare let System;
99
const futureFoo = {
1010
name: 'foo.**',
1111
url: '/foo',
12-
loadChildren: () => System.import('./foo/foo.module').then(x => x.FooModule),
12+
loadChildren: () => import('./foo/foo.module').then(x => x.FooModule),
1313
};
1414

1515
const futureBar = {
1616
name: 'bar.**',
1717
url: '/bar',
18-
loadChildren: () => System.import('./foo/foo.module').then(x => x.FooModule),
18+
loadChildren: () => import('./foo/foo.module').then(x => x.FooModule),
1919
};
2020

2121
const augment1 = {
2222
name: 'augment1',
2323
url: '/augment1',
24-
loadChildren: () => System.import('./augment/augment.module').then(x => x.AugmentModule),
24+
loadChildren: () => import('./augment/augment.module').then(x => x.AugmentModule),
2525
};
2626

2727
const augment2 = {

test/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"emitDecoratorMetadata": true,
44
"experimentalDecorators": true,
55
"moduleResolution": "node",
6-
"module": "es6",
6+
"module": "esnext",
77
"target": "es5",
88
"lib": ["es6", "dom"],
99
"allowSyntheticDefaultImports": true,

0 commit comments

Comments
 (0)