From 0cba11d5131f0df24719820dba6b5b5b618acfec Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 31 Mar 2020 16:27:42 +0200 Subject: [PATCH 1/2] refactor(@angular-devkit/build-angular): remove deprecation of `namedChunks` Previusly this option didn't have an effect on platform server because when targetting commonjs all chunks will be concatenated into main.js. We now changed the module to esnext, which enables us to have lazy loading on the server. --- packages/angular_devkit/build_angular/src/server/schema.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/server/schema.json b/packages/angular_devkit/build_angular/src/server/schema.json index e62f1cb0c517..5cd233459072 100644 --- a/packages/angular_devkit/build_angular/src/server/schema.json +++ b/packages/angular_devkit/build_angular/src/server/schema.json @@ -213,8 +213,7 @@ "namedChunks": { "type": "boolean", "description": "Use file name for lazy loaded chunks.", - "default": true, - "x-deprecated": "Since version 9. This option has no effect on server platform." + "default": true }, "bundleDependencies": { "description": "Which external dependencies to bundle into the bundle. By default, all of node_modules will be bundled.", From 5a3716e2312cd9aafe011a386f0e1c9a5d755cad Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Tue, 31 Mar 2020 16:30:05 +0200 Subject: [PATCH 2/2] feat(@schematics/angular): enable lazy loading on the server for new projects With this change, lazy-loading on the server becomes enabled out of the box for new projects. This is because webpack will only split ES6 imports into separate chunks. However when using commonjs all lazy loaded paths will be concatenated into the main.js file. --- .../universal/files/root/__tsconfigFileName__.json.template | 1 - packages/schematics/angular/universal/index_spec.ts | 2 -- .../build_angular/hello-world-app-ve/src/tsconfig.server.json | 1 - .../build_angular/hello-world-app/src/tsconfig.server.json | 1 - 4 files changed, 5 deletions(-) diff --git a/packages/schematics/angular/universal/files/root/__tsconfigFileName__.json.template b/packages/schematics/angular/universal/files/root/__tsconfigFileName__.json.template index 06b8b6ee92dc..8c588ac885c8 100644 --- a/packages/schematics/angular/universal/files/root/__tsconfigFileName__.json.template +++ b/packages/schematics/angular/universal/files/root/__tsconfigFileName__.json.template @@ -2,7 +2,6 @@ "extends": "./<%= tsConfigExtends %>", "compilerOptions": { "outDir": "<%= outDir %>-server", - "module": "commonjs", "types": [ "node" ] diff --git a/packages/schematics/angular/universal/index_spec.ts b/packages/schematics/angular/universal/index_spec.ts index b6d072eef9c4..291c48da379b 100644 --- a/packages/schematics/angular/universal/index_spec.ts +++ b/packages/schematics/angular/universal/index_spec.ts @@ -91,7 +91,6 @@ describe('Universal Schematic', () => { extends: './tsconfig.app.json', compilerOptions: { outDir: './out-tsc/app-server', - module: 'commonjs', types: ['node'], }, files: [ @@ -116,7 +115,6 @@ describe('Universal Schematic', () => { extends: './tsconfig.app.json', compilerOptions: { outDir: '../../out-tsc/app-server', - module: 'commonjs', types: ['node'], }, files: [ diff --git a/tests/angular_devkit/build_angular/hello-world-app-ve/src/tsconfig.server.json b/tests/angular_devkit/build_angular/hello-world-app-ve/src/tsconfig.server.json index ca19d0259199..f3c0d685c1dc 100644 --- a/tests/angular_devkit/build_angular/hello-world-app-ve/src/tsconfig.server.json +++ b/tests/angular_devkit/build_angular/hello-world-app-ve/src/tsconfig.server.json @@ -2,7 +2,6 @@ "extends": "./tsconfig.app.json", "compilerOptions": { "outDir": "../dist-server", - "module": "commonjs", "types": [] }, "files": [ diff --git a/tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.server.json b/tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.server.json index eb321efe8f51..b80c86c867df 100644 --- a/tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.server.json +++ b/tests/angular_devkit/build_angular/hello-world-app/src/tsconfig.server.json @@ -3,7 +3,6 @@ "compilerOptions": { "outDir": "../dist-server", "baseUrl": "./", - "module": "commonjs", "types": [] }, "files": [