refactor(@angular-devkit/build-angular): drop support for zone.js 0.10

BREAKING CHANGE:

Minimum supported `zone.js` version is `0.11.4`
This commit is contained in:
Alan Agius 2021-02-11 19:51:53 +01:00 committed by Filipe Silva
parent bb38f85202
commit f309516bcd
10 changed files with 14 additions and 33 deletions

View File

@ -13,4 +13,4 @@ export const environment = {
* This import should be commented out in production mode because it will have a negative impact * This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown. * on performance if an error is thrown.
*/ */
// import 'zone.js/dist/zone-error'; // Included with Angular CLI. // import 'zone.js/plugins/zone-error'; // Included with Angular CLI.

View File

@ -55,7 +55,7 @@
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by default for Angular itself. * Zone JS is required by default for Angular itself.
*/ */
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js'; // Included with Angular CLI.
/*************************************************************************************************** /***************************************************************************************************

View File

@ -1,6 +1,6 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files // This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing'; import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing'; import { getTestBed } from '@angular/core/testing';
import { import {
BrowserDynamicTestingModule, BrowserDynamicTestingModule,

View File

@ -184,11 +184,9 @@ describe('Browser Builder with differential loading', () => {
it('uses the right zone.js variant', async () => { it('uses the right zone.js variant', async () => {
const { files } = await browserBuild(architect, host, target, { optimization: false }); const { files } = await browserBuild(architect, host, target, { optimization: false });
expect(await files['polyfills-es5.js']).toContain('zone.js/dist/zone-legacy'); expect(await files['polyfills-es5.js']).toContain('zone.js/plugins/zone-legacy');
expect(await files['polyfills-es5.js']).toContain('registerElementPatch'); 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']).not.toContain('zone.js/plugins/zone-legacy');
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-es2015.js']).not.toContain('registerElementPatch');
}); });

View File

@ -68,23 +68,6 @@ export async function generateWebpackConfig(
const webpackConfig = webpackMerge(webpackPartialGenerator(wco)); const webpackConfig = webpackMerge(webpackPartialGenerator(wco));
if (supportES2015) {
if (!webpackConfig.resolve) {
webpackConfig.resolve = {};
}
if (Array.isArray(webpackConfig.resolve.alias)) {
webpackConfig.resolve.alias.push({
alias: 'zone.js/dist/zone',
name: 'zone.js/dist/zone-evergreen',
});
} else {
if (!webpackConfig.resolve.alias) {
webpackConfig.resolve.alias = {};
}
webpackConfig.resolve.alias['zone.js/dist/zone'] = 'zone.js/dist/zone-evergreen';
}
}
if (profilingEnabled) { if (profilingEnabled) {
const esVersionInFileName = getEsVersionForFileName( const esVersionInFileName = getEsVersionForFileName(
tsConfig.options.target, tsConfig.options.target,

View File

@ -91,11 +91,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
if (buildBrowserFeatures.isEs5SupportNeeded()) { if (buildBrowserFeatures.isEs5SupportNeeded()) {
const polyfillsChunkName = 'polyfills-es5'; const polyfillsChunkName = 'polyfills-es5';
entryPoints[polyfillsChunkName] = [path.join(__dirname, '..', 'es5-polyfills.js')]; entryPoints[polyfillsChunkName] = [path.join(__dirname, '..', 'es5-polyfills.js')];
if (differentialLoadingMode) {
// Add zone.js legacy support to the es5 polyfills
// This is a noop execution-wise if zone-evergreen is not used.
entryPoints[polyfillsChunkName].push('zone.js/dist/zone-legacy');
if (differentialLoadingMode) {
// Since the chunkFileName option schema does not allow the function overload, add a plugin // Since the chunkFileName option schema does not allow the function overload, add a plugin
// that changes the name of the ES5 polyfills chunk to not include ES2015. // that changes the name of the ES5 polyfills chunk to not include ES2015.
extraPlugins.push({ extraPlugins.push({

View File

@ -112,3 +112,6 @@ import 'core-js/modules/es.promise';
import 'core-js/modules/es.json.to-string-tag'; import 'core-js/modules/es.json.to-string-tag';
import 'regenerator-runtime/runtime'; import 'regenerator-runtime/runtime';
// Zone.js
import 'zone.js/plugins/zone-legacy';

View File

@ -65,7 +65,7 @@ import '@angular/localize/init';
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by default for Angular itself. * Zone JS is required by default for Angular itself.
*/ */
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js'; // Included with Angular CLI.
/*************************************************************************************************** /***************************************************************************************************
* APPLICATION IMPORTS * APPLICATION IMPORTS

View File

@ -7,7 +7,7 @@
*/ */
// This file is required by karma.conf.js and loads recursively all the .spec and framework files // This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing'; import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing'; import { getTestBed } from '@angular/core/testing';
import { import {
BrowserDynamicTestingModule, BrowserDynamicTestingModule,

View File

@ -7,8 +7,8 @@
*/ */
// This file is required by karma.conf.js and loads recursively all the .spec and framework files // This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone'; import 'zone.js';
import 'zone.js/dist/zone-testing'; import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing'; import { getTestBed } from '@angular/core/testing';
import { import {
BrowserDynamicTestingModule, BrowserDynamicTestingModule,