Skip to content

Commit 0d1826b

Browse files
alan-agius4filipesilva
authored andcommitted
test(@ngtools/webpack): update lazy loading string syntax to use dynamic imports
1 parent 988b05a commit 0d1826b

File tree

6 files changed

+6
-70
lines changed

6 files changed

+6
-70
lines changed

packages/schematics/angular/migrations/migration-collection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"lazy-loading-string-syntax": {
144144
"version": "12.0.0-next.4",
145145
"factory": "./update-8/#updateLazyModulePaths",
146-
"description": "Lazy loading syntax migration. Update lazy loading syntax to use dynamic imports."
146+
"description": "Lazy loading syntax migration. Update lazy loading string syntax to use dynamic imports."
147147
}
148148
}
149149
}

tests/legacy-cli/e2e/assets/webpack/test-app/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class HomeView {}
1818
imports: [
1919
BrowserModule,
2020
RouterModule.forRoot([
21-
{path: 'lazy', loadChildren: './lazy.module#LazyModule'},
21+
{path: 'lazy', loadChildren: () => import('./lazy.module').then(m => m.LazyModule)},
2222
{path: '', component: HomeView}
2323
])
2424
],

tests/legacy-cli/e2e/assets/webpack/test-app/app/lazy.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export class LazyComponent {}
1111
imports: [
1212
RouterModule.forChild([
1313
{path: '', component: LazyComponent, pathMatch: 'full'},
14-
{path: 'feature', loadChildren: './feature/feature.module#FeatureModule'},
15-
{path: 'lazy-feature', loadChildren: './feature/lazy-feature.module#LazyFeatureModule'}
14+
{path: 'feature', loadChildren: () => import( './feature/feature.module').then(m => m.FeatureModule)},
15+
{path: 'lazy-feature', loadChildren: () => import( './feature/lazy-feature.module').then(m => m.LazyFeatureModule)},
1616
]),
1717
],
1818
declarations: [LazyComponent]

tests/legacy-cli/e2e/tests/build/dynamic-import.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

tests/legacy-cli/e2e/tests/build/lazy-load-syntax.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,4 @@ export default async function () {
8484

8585
await ng('e2e');
8686
await ng('e2e', '--configuration=production');
87-
88-
// Test string import.
89-
// Both Ivy and View Engine should support it.
90-
await updateJsonFile('tsconfig.app.json', tsConfig => {
91-
tsConfig.files.push('src/app/lazy/lazy.module.ts');
92-
});
93-
await replaceLoadChildren(`'./lazy/lazy.module#LazyModule'`);
94-
await ng('e2e');
95-
await ng('e2e', '--configuration=production');
9687
}

tests/legacy-cli/e2e/tests/packages/webpack/test-app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ export default async function (skipCleaning: () => void) {
2323

2424
// Note: these sizes are without Build Optimizer or any advanced optimizations in the CLI.
2525
await expectFileSizeToBeUnder('dist/app.main.js', (isVe ? 483 : 565) * 1024);
26-
await expectFileSizeToBeUnder('dist/0.app.main.js', 1 * 1024);
26+
await expectFileSizeToBeUnder('dist/1.app.main.js', 1 * 1024);
2727
await expectFileSizeToBeUnder('dist/2.app.main.js', 2 * 1024);
2828

29+
2930
// test resource urls without ./
3031
await replaceInFile('app/app.component.ts', './app.component.html', 'app.component.html');
3132
await replaceInFile('app/app.component.ts', './app.component.scss', 'app.component.scss');

0 commit comments

Comments
 (0)