diff --git a/integration/angular_cli/e2e/tsconfig.json b/integration/angular_cli/e2e/tsconfig.json index 39b800f78961..c92199cfd63f 100644 --- a/integration/angular_cli/e2e/tsconfig.json +++ b/integration/angular_cli/e2e/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "../out-tsc/e2e", "module": "commonjs", - "target": "es5", + "target": "es2018", "types": [ "jasmine", "jasminewd2", diff --git a/integration/angular_cli/tsconfig.json b/integration/angular_cli/tsconfig.json index 8c4ef3bbae3a..28b9d3a9c9fa 100644 --- a/integration/angular_cli/tsconfig.json +++ b/integration/angular_cli/tsconfig.json @@ -7,10 +7,10 @@ "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, - "module": "esnext", + "module": "es2020", "moduleResolution": "node", "importHelpers": true, - "target": "es2015", + "target": "es2016", "lib": [ "es2018", "dom" diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts index b7561498d3d9..dfb0b6e72eea 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts @@ -193,7 +193,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration { if (profilingEnabled) { extraPlugins.push( new debug.ProfilingPlugin({ - outputPath: path.resolve(root, `chrome-profiler-events${targetInFileName}.json`), + outputPath: path.resolve(root, 'chrome-profiler-events.json'), }), ); } @@ -302,7 +302,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration { apply(compiler: Compiler) { compiler.hooks.emit.tap('angular-cli-stats', compilation => { const data = JSON.stringify(compilation.getStats().toJson('verbose')); - compilation.assets[`stats${targetInFileName}.json`] = new RawSource(data); + compilation.assets['stats.json'] = new RawSource(data); }); } })(), diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator.ts index 8e380442a5c4..63469f36c128 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator.ts @@ -32,7 +32,8 @@ export enum ThresholdSeverity { } enum DifferentialBuildType { - ORIGINAL = 'es2015', + // FIXME: this should match the actual file suffix and not hardcoded. + ORIGINAL = 'es2016', DOWNLEVEL = 'es5', } diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator_spec.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator_spec.ts index 17988d6f0e75..605816760fbd 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator_spec.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator_spec.ts @@ -126,7 +126,7 @@ describe('bundle-calculator', () => { { name: '0', original: { - filename: 'foo-es2015.js', + filename: 'foo-es2016.js', size: 1.25 * KB, }, downlevel: { @@ -141,7 +141,7 @@ describe('bundle-calculator', () => { expect(failures.length).toBe(2); expect(failures).toContain({ severity: ThresholdSeverity.Error, - message: jasmine.stringMatching('Exceeded maximum budget for foo-es2015.'), + message: jasmine.stringMatching('Exceeded maximum budget for foo-es2016.'), }); expect(failures).toContain({ severity: ThresholdSeverity.Error, @@ -170,7 +170,7 @@ describe('bundle-calculator', () => { name: '0', // Individual builds are under budget, but combined they are over. original: { - filename: 'foo-es2015.js', + filename: 'foo-es2016.js', size: 0.5 * KB, }, downlevel: { @@ -240,7 +240,7 @@ describe('bundle-calculator', () => { name: '0', // Individual builds are under budget, but combined they are over. original: { - filename: 'initial-es2015.js', + filename: 'initial-es2016.js', size: 1.25 * KB, }, downlevel: { @@ -255,7 +255,7 @@ describe('bundle-calculator', () => { expect(failures.length).toBe(2); expect(failures).toContain({ severity: ThresholdSeverity.Error, - message: jasmine.stringMatching('Exceeded maximum budget for initial-es2015.'), + message: jasmine.stringMatching('Exceeded maximum budget for initial-es2016.'), }); expect(failures).toContain({ severity: ThresholdSeverity.Error, @@ -283,7 +283,7 @@ describe('bundle-calculator', () => { name: '0', // Individual builds are under budget, but combined they are over. original: { - filename: 'initial-es2015.js', + filename: 'initial-es2016.js', size: 0.5 * KB, }, downlevel: { diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/index-file/augment-index-html_spec.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/index-file/augment-index-html_spec.ts index a986e007d0de..bdb1357e50f4 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/index-file/augment-index-html_spec.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/index-file/augment-index-html_spec.ts @@ -51,10 +51,10 @@ describe('augment-index-html', () => { it(`should emit correct script tags when having 'module' and 'non-module' js`, async () => { const es2015JsFiles: FileInfo[] = [ - { file: 'runtime-es2015.js', extension: '.js', name: 'main' }, - { file: 'main-es2015.js', extension: '.js', name: 'main' }, - { file: 'runtime-es2015.js', extension: '.js', name: 'polyfills' }, - { file: 'polyfills-es2015.js', extension: '.js', name: 'polyfills' }, + { file: 'runtime-es2016.js', extension: '.js', name: 'main' }, + { file: 'main-es2016.js', extension: '.js', name: 'main' }, + { file: 'runtime-es2016.js', extension: '.js', name: 'polyfills' }, + { file: 'polyfills-es2016.js', extension: '.js', name: 'polyfills' }, ]; const es5JsFiles: FileInfo[] = [ @@ -82,11 +82,11 @@ describe('augment-index-html', () => { - - + + - + @@ -98,7 +98,7 @@ describe('augment-index-html', () => { async () => { const es2015JsFiles: FileInfo[] = [ { file: 'scripts.js', extension: '.js', name: 'scripts' }, - { file: 'main-es2015.js', extension: '.js', name: 'main' }, + { file: 'main-es2016.js', extension: '.js', name: 'main' }, ]; const es5JsFiles: FileInfo[] = [ @@ -125,7 +125,7 @@ describe('augment-index-html', () => { - + diff --git a/packages/angular_devkit/build_angular/src/browser/specs/differential_loading_spec.ts b/packages/angular_devkit/build_angular/src/browser/specs/differential_loading_spec.ts index b8df000b13a7..5d80548a809c 100644 --- a/packages/angular_devkit/build_angular/src/browser/specs/differential_loading_spec.ts +++ b/packages/angular_devkit/build_angular/src/browser/specs/differential_loading_spec.ts @@ -33,28 +33,28 @@ describe('Browser Builder with differential loading', () => { 'favicon.ico', 'index.html', - 'main-es2015.js', - 'main-es2015.js.map', + 'main-es2016.js', + 'main-es2016.js.map', 'main-es5.js', 'main-es5.js.map', - 'polyfills-es2015.js', - 'polyfills-es2015.js.map', + 'polyfills-es2016.js', + 'polyfills-es2016.js.map', 'polyfills-es5.js', 'polyfills-es5.js.map', - 'runtime-es2015.js', - 'runtime-es2015.js.map', + 'runtime-es2016.js', + 'runtime-es2016.js.map', 'runtime-es5.js', 'runtime-es5.js.map', - 'styles-es2015.js', - 'styles-es2015.js.map', + 'styles-es2016.js', + 'styles-es2016.js.map', 'styles-es5.js', 'styles-es5.js.map', - 'vendor-es2015.js', - 'vendor-es2015.js.map', + 'vendor-es2016.js', + 'vendor-es2016.js.map', 'vendor-es5.js', 'vendor-es5.js.map', ] as PathFragment[]; @@ -178,7 +178,7 @@ describe('Browser Builder with differential loading', () => { vendorChunk: false, }); expect(await files['main-es5.js']).not.toContain('const '); - expect(await files['main-es2015.js']).toContain('const '); + expect(await files['main-es2016.js']).toContain('const '); }); it('uses the right zone.js variant', async () => { @@ -186,9 +186,9 @@ describe('Browser Builder with differential loading', () => { expect(await files['polyfills-es5.js']).toContain('zone.js/dist/zone-legacy'); expect(await files['polyfills-es5.js']).toContain('registerElementPatch'); expect(await files['polyfills-es5.js']).toContain('zone.js/dist/zone-evergreen'); - expect(await files['polyfills-es2015.js']).toContain('zone.js/dist/zone-evergreen'); - expect(await files['polyfills-es2015.js']).not.toContain('zone.js/dist/zone-legacy'); - expect(await files['polyfills-es2015.js']).not.toContain('registerElementPatch'); + expect(await files['polyfills-es2016.js']).toContain('zone.js/dist/zone-evergreen'); + expect(await files['polyfills-es2016.js']).not.toContain('zone.js/dist/zone-legacy'); + expect(await files['polyfills-es2016.js']).not.toContain('registerElementPatch'); }); it('adds `type="module"` when differential loading is needed', async () => { diff --git a/packages/angular_devkit/build_angular/test/hello-world-app/e2e/tsconfig.e2e.json b/packages/angular_devkit/build_angular/test/hello-world-app/e2e/tsconfig.e2e.json index 39b800f78961..c92199cfd63f 100644 --- a/packages/angular_devkit/build_angular/test/hello-world-app/e2e/tsconfig.e2e.json +++ b/packages/angular_devkit/build_angular/test/hello-world-app/e2e/tsconfig.e2e.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "../out-tsc/e2e", "module": "commonjs", - "target": "es5", + "target": "es2018", "types": [ "jasmine", "jasminewd2", diff --git a/packages/angular_devkit/build_angular/test/hello-world-app/tsconfig.json b/packages/angular_devkit/build_angular/test/hello-world-app/tsconfig.json index ea3c9bcf3ffd..ebd973919abb 100644 --- a/packages/angular_devkit/build_angular/test/hello-world-app/tsconfig.json +++ b/packages/angular_devkit/build_angular/test/hello-world-app/tsconfig.json @@ -9,8 +9,8 @@ "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, - "target": "es2015", - "module": "esnext", + "target": "es2016", + "module": "es2020", "typeRoots": [ "../node_modules/@types" ], diff --git a/packages/angular_devkit/build_ng_packagr/test/ng-packaged/projects/lib/tsconfig.lib.json b/packages/angular_devkit/build_ng_packagr/test/ng-packaged/projects/lib/tsconfig.lib.json index e9e014ba574d..04941452ed17 100644 --- a/packages/angular_devkit/build_ng_packagr/test/ng-packaged/projects/lib/tsconfig.lib.json +++ b/packages/angular_devkit/build_ng_packagr/test/ng-packaged/projects/lib/tsconfig.lib.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "target": "es2015", + "target": "es2016", "declaration": true, "inlineSources": true, "types": [], diff --git a/packages/angular_devkit/build_ng_packagr/test/ng-packaged/tsconfig.json b/packages/angular_devkit/build_ng_packagr/test/ng-packaged/tsconfig.json index d9a4c4b50abe..962987a7f871 100644 --- a/packages/angular_devkit/build_ng_packagr/test/ng-packaged/tsconfig.json +++ b/packages/angular_devkit/build_ng_packagr/test/ng-packaged/tsconfig.json @@ -7,8 +7,8 @@ "declaration": false, "moduleResolution": "node", "experimentalDecorators": true, - "target": "es2015", - "module": "esnext", + "target": "es2016", + "module": "es2020", "typeRoots": [ "node_modules/@types" ], diff --git a/packages/angular_devkit/build_webpack/test/angular-app/src/tsconfig.app.json b/packages/angular_devkit/build_webpack/test/angular-app/src/tsconfig.app.json index b90ffb0148a4..40a1cd9e3ec6 100644 --- a/packages/angular_devkit/build_webpack/test/angular-app/src/tsconfig.app.json +++ b/packages/angular_devkit/build_webpack/test/angular-app/src/tsconfig.app.json @@ -2,7 +2,7 @@ "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/app", - "module": "es2015", + "module": "es2020", "types": [] }, "exclude": [ diff --git a/packages/schematics/angular/e2e/files/tsconfig.json.template b/packages/schematics/angular/e2e/files/tsconfig.json.template index cc3e6d1cb952..bb011f580373 100644 --- a/packages/schematics/angular/e2e/files/tsconfig.json.template +++ b/packages/schematics/angular/e2e/files/tsconfig.json.template @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "<%= relativePathToWorkspaceRoot %>/out-tsc/e2e", "module": "commonjs", - "target": "es5", + "target": "es2018", "types": [ "jasmine", "jasminewd2", diff --git a/packages/schematics/angular/migrations/migration-collection.json b/packages/schematics/angular/migrations/migration-collection.json index 80242963291b..fa903a33a36c 100644 --- a/packages/schematics/angular/migrations/migration-collection.json +++ b/packages/schematics/angular/migrations/migration-collection.json @@ -84,6 +84,11 @@ "version": "10.0.0-beta.3", "factory": "./update-10/update-angular-config", "description": "Remove deprecated 'evalSourceMap', `profile`, 'skipAppShell' and 'vendorSourceMap' from 'angular.json'." + }, + "update-module-and-target-compiler-options": { + "version": "10.0.0-next.3", + "factory": "./update-10/update-module-and-target-compiler-options", + "description": "Update 'module' and 'target' TypeScript compiler options." } } } diff --git a/packages/schematics/angular/migrations/update-10/update-module-and-target-compiler-options.ts b/packages/schematics/angular/migrations/update-10/update-module-and-target-compiler-options.ts new file mode 100644 index 000000000000..b5d3070e5fda --- /dev/null +++ b/packages/schematics/angular/migrations/update-10/update-module-and-target-compiler-options.ts @@ -0,0 +1,128 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { dirname, join, normalize } from '@angular-devkit/core'; +import { Rule, Tree } from '@angular-devkit/schematics'; +import { findPropertyInAstObject, removePropertyInAstObject } from '../../utility/json-utils'; +import { getWorkspace } from '../../utility/workspace'; +import { Builders } from '../../utility/workspace-models'; +import { readJsonFileAsAstObject } from '../update-9/utils'; + + +interface ModuleAndTargetReplamenent { + oldModule?: string; + newModule?: string | false; + oldTarget?: string; + newTarget?: string; +} + +export default function (): Rule { + return async host => { + // Workspace level tsconfig + updateModuleAndTarget(host, 'tsconfig.json', { + oldModule: 'esnext', + newModule: 'es2020', + oldTarget: 'es2015', + newTarget: 'es2016', + }); + + const workspace = await getWorkspace(host); + // Find all tsconfig which are refereces used by builders + for (const [, project] of workspace.projects) { + for (const [, target] of project.targets) { + // E2E builder doesn't reference a tsconfig but it uses one found in the root folder. + if (target.builder === Builders.Protractor && typeof target.options?.protractorConfig === 'string') { + const tsConfigPath = join(dirname(normalize(target.options.protractorConfig)), 'tsconfig.json'); + + updateModuleAndTarget(host, tsConfigPath, { + oldTarget: 'es5', + newTarget: 'es2018', + }); + + continue; + } + + // Update all other known CLI builders that use a tsconfig + const tsConfigs = [ + target.options || {}, + ...Object.values(target.configurations || {}), + ] + .filter(opt => typeof opt?.tsConfig === 'string') + .map(opt => (opt as { tsConfig: string }).tsConfig); + + const uniqueTsConfigs = [...new Set(tsConfigs)]; + + if (uniqueTsConfigs.length < 1) { + continue; + } + + switch (target.builder as Builders) { + case Builders.Server: + uniqueTsConfigs.forEach(p => { + updateModuleAndTarget(host, p, { + oldModule: 'commonjs', + // False will remove the module + // NB: For server we no longer use commonjs because it is bundled using webpack which has it's own module system. + // This ensures that lazy-loaded works on the server. + newModule: false, + }); + }); + break; + case Builders.Karma: + case Builders.Browser: + case Builders.NgPackagr: + uniqueTsConfigs.forEach(p => { + updateModuleAndTarget(host, p, { + oldModule: 'esnext', + newModule: 'es2020', + oldTarget: 'es2015', + newTarget: 'es2016', + }); + }); + break; + } + } + } + }; +} + +function updateModuleAndTarget(host: Tree, tsConfigPath: string, replacements: ModuleAndTargetReplamenent) { + const jsonAst = readJsonFileAsAstObject(host, tsConfigPath); + if (!jsonAst) { + return; + } + + const compilerOptionsAst = findPropertyInAstObject(jsonAst, 'compilerOptions'); + if (compilerOptionsAst?.kind !== 'object') { + return; + } + + const { oldTarget, newTarget, newModule, oldModule } = replacements; + + const recorder = host.beginUpdate(tsConfigPath); + if (newTarget) { + const targetAst = findPropertyInAstObject(compilerOptionsAst, 'target'); + if (targetAst?.kind === 'string' && oldTarget === targetAst.value.toLowerCase()) { + const offset = targetAst.start.offset + 1; + recorder.remove(offset, targetAst.value.length); + recorder.insertLeft(offset, newTarget); + } + } + + if (newModule === false) { + removePropertyInAstObject(recorder, compilerOptionsAst, 'module'); + } else if (newModule) { + const moduleAst = findPropertyInAstObject(compilerOptionsAst, 'module'); + if (moduleAst?.kind === 'string' && oldModule === moduleAst.value.toLowerCase()) { + const offset = moduleAst.start.offset + 1; + recorder.remove(offset, moduleAst.value.length); + recorder.insertLeft(offset, newModule); + } + } + + host.commitUpdate(recorder); +} diff --git a/packages/schematics/angular/migrations/update-10/update-module-and-target-compiler-options_spec.ts b/packages/schematics/angular/migrations/update-10/update-module-and-target-compiler-options_spec.ts new file mode 100644 index 000000000000..feef0d9e9957 --- /dev/null +++ b/packages/schematics/angular/migrations/update-10/update-module-and-target-compiler-options_spec.ts @@ -0,0 +1,144 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import { JsonParseMode, parseJson } from '@angular-devkit/core'; +import { EmptyTree } from '@angular-devkit/schematics'; +import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; +import { Builders, ProjectType, WorkspaceSchema } from '../../utility/workspace-models'; + +describe('Migration to update target and module compiler options', () => { + const schematicName = 'update-module-and-target-compiler-options'; + + const schematicRunner = new SchematicTestRunner( + 'migrations', + require.resolve('../migration-collection.json'), + ); + + function createJsonFile(tree: UnitTestTree, filePath: string, content: {}) { + tree.create(filePath, JSON.stringify(content, undefined, 2)); + } + + // tslint:disable-next-line: no-any + function readJsonFile(tree: UnitTestTree, filePath: string): any { + // tslint:disable-next-line: no-any + return parseJson(tree.readContent(filePath).toString(), JsonParseMode.Loose) as any; + } + + function createWorkSpaceConfig(tree: UnitTestTree) { + const angularConfig: WorkspaceSchema = { + version: 1, + projects: { + app: { + root: '', + sourceRoot: 'src', + projectType: ProjectType.Application, + prefix: 'app', + architect: { + build: { + builder: Builders.Browser, + options: { + tsConfig: 'src/tsconfig.app.json', + main: '', + polyfills: '', + }, + configurations: { + production: { + tsConfig: 'src/tsconfig.app.prod.json', + }, + }, + }, + test: { + builder: Builders.Karma, + options: { + karmaConfig: '', + tsConfig: 'src/tsconfig.spec.json', + }, + }, + e2e: { + builder: Builders.Protractor, + options: { + protractorConfig: 'src/e2e/protractor.conf.js', + devServerTarget: '', + }, + }, + server: { + builder: Builders.Server, + options: { + tsConfig: 'src/tsconfig.server.json', + outputPath: '', + main: '', + }, + }, + }, + }, + }, + }; + + createJsonFile(tree, 'angular.json', angularConfig); + } + + + let tree: UnitTestTree; + beforeEach(() => { + tree = new UnitTestTree(new EmptyTree()); + createWorkSpaceConfig(tree); + + // Create tsconfigs + const compilerOptions = { target: 'es2015', module: 'esnext' }; + + // Workspace + createJsonFile(tree, 'tsconfig.json', { compilerOptions }); + + // Application + createJsonFile(tree, 'src/tsconfig.app.json', { compilerOptions }); + createJsonFile(tree, 'src/tsconfig.app.prod.json', { compilerOptions }); + createJsonFile(tree, 'src/tsconfig.spec.json', { compilerOptions }); + + // E2E + createJsonFile(tree, 'src/e2e/protractor.conf.js', ''); + createJsonFile(tree, 'src/e2e/tsconfig.json', { compilerOptions: { module: 'commonjs', target: 'es5' } }); + + // Universal + createJsonFile(tree, 'src/tsconfig.server.json', { compilerOptions: { module: 'commonjs' } }); + }); + + it(`should update module and target in workspace 'tsconfig.json'`, async () => { + const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise(); + const { module, target } = readJsonFile(newTree, 'tsconfig.json').compilerOptions; + expect(module).toBe('es2020'); + expect(target).toBe('es2016'); + }); + + it(`should update module and target in 'tsconfig.json' which is referenced in option`, async () => { + const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise(); + const { module, target } = readJsonFile(newTree, 'src/tsconfig.spec.json').compilerOptions; + expect(module).toBe('es2020'); + expect(target).toBe('es2016'); + }); + + it(`should update module and target in 'tsconfig.json' which is referenced in a configuration`, async () => { + const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise(); + const { module, target } = readJsonFile(newTree, 'src/tsconfig.app.prod.json').compilerOptions; + expect(module).toBe('es2020'); + expect(target).toBe('es2016'); + }); + + it(`should update target to es2018 in E2E 'tsconfig.json'`, async () => { + const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise(); + const { module, target } = readJsonFile(newTree, 'src/e2e/tsconfig.json').compilerOptions; + expect(module).toBe('commonjs'); + expect(target).toBe('es2018'); + }); + + + it(`should remove module in 'tsconfig.server.json'`, async () => { + const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise(); + const { module, target } = readJsonFile(newTree, 'src/tsconfig.server.json').compilerOptions; + expect(module).toBeUndefined(); + expect(target).toBeUndefined(); + }); +}); diff --git a/packages/schematics/angular/workspace/files/tsconfig.json.template b/packages/schematics/angular/workspace/files/tsconfig.json.template index 3d26cd364b2c..a0787f74af68 100644 --- a/packages/schematics/angular/workspace/files/tsconfig.json.template +++ b/packages/schematics/angular/workspace/files/tsconfig.json.template @@ -12,10 +12,10 @@ "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, - "module": "esnext", + "module": "es2020", "moduleResolution": "node", "importHelpers": true, - "target": "es2015", + "target": "es2016", "lib": [ "es2018", "dom" diff --git a/tests/legacy-cli/e2e/assets/1.7-project/e2e/tsconfig.e2e.json b/tests/legacy-cli/e2e/assets/1.7-project/e2e/tsconfig.e2e.json index 1d9e5edf0965..78b5000e2870 100644 --- a/tests/legacy-cli/e2e/assets/1.7-project/e2e/tsconfig.e2e.json +++ b/tests/legacy-cli/e2e/assets/1.7-project/e2e/tsconfig.e2e.json @@ -4,7 +4,7 @@ "outDir": "../out-tsc/e2e", "baseUrl": "./", "module": "commonjs", - "target": "es5", + "target": "es2018", "types": [ "jasmine", "jasminewd2", diff --git a/tests/legacy-cli/e2e/assets/7.0-project/e2e/tsconfig.e2e.json b/tests/legacy-cli/e2e/assets/7.0-project/e2e/tsconfig.e2e.json index a6dd62202824..db33721a1918 100644 --- a/tests/legacy-cli/e2e/assets/7.0-project/e2e/tsconfig.e2e.json +++ b/tests/legacy-cli/e2e/assets/7.0-project/e2e/tsconfig.e2e.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "../out-tsc/app", "module": "commonjs", - "target": "es5", + "target": "es2018", "types": [ "jasmine", "jasminewd2", diff --git a/tests/legacy-cli/e2e/tests/build/differential-loading.ts b/tests/legacy-cli/e2e/tests/build/differential-loading.ts index 02c483570716..9a8051102f8b 100644 --- a/tests/legacy-cli/e2e/tests/build/differential-loading.ts +++ b/tests/legacy-cli/e2e/tests/build/differential-loading.ts @@ -31,19 +31,19 @@ export default async function () { await expectFileToMatch( 'dist/test-project/index.html', oneLineTrim` - + - + - + - + `, ); - await expectFileToMatch('dist/test-project/vendor-es2015.js', /class \w{constructor\(/); + await expectFileToMatch('dist/test-project/vendor-es2016.js', /class \w{constructor\(/); await expectToFail(() => expectFileToMatch('dist/test-project/vendor-es5.js', /class \w{constructor\(/)); } diff --git a/tests/legacy-cli/e2e/tests/build/polyfills.ts b/tests/legacy-cli/e2e/tests/build/polyfills.ts index 080bbddd5c23..160be05fb347 100644 --- a/tests/legacy-cli/e2e/tests/build/polyfills.ts +++ b/tests/legacy-cli/e2e/tests/build/polyfills.ts @@ -24,7 +24,7 @@ export default async function () { await expectFileToMatch('dist/test-project/index.html', oneLineTrim` - -