mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 01:54:04 +08:00
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:
parent
bb38f85202
commit
f309516bcd
@ -13,4 +13,4 @@ export const environment = {
|
||||
* This import should be commented out in production mode because it will have a negative impact
|
||||
* 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.
|
||||
|
@ -55,7 +55,7 @@
|
||||
/***************************************************************************************************
|
||||
* 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.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
|
@ -1,6 +1,6 @@
|
||||
// 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 {
|
||||
BrowserDynamicTestingModule,
|
||||
|
@ -184,11 +184,9 @@ describe('Browser Builder with differential loading', () => {
|
||||
|
||||
it('uses the right zone.js variant', async () => {
|
||||
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('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('zone.js/plugins/zone-legacy');
|
||||
expect(await files['polyfills-es2015.js']).not.toContain('registerElementPatch');
|
||||
});
|
||||
|
||||
|
@ -68,23 +68,6 @@ export async function generateWebpackConfig(
|
||||
|
||||
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) {
|
||||
const esVersionInFileName = getEsVersionForFileName(
|
||||
tsConfig.options.target,
|
||||
|
@ -91,11 +91,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
|
||||
if (buildBrowserFeatures.isEs5SupportNeeded()) {
|
||||
const polyfillsChunkName = 'polyfills-es5';
|
||||
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
|
||||
// that changes the name of the ES5 polyfills chunk to not include ES2015.
|
||||
extraPlugins.push({
|
||||
|
@ -111,4 +111,7 @@ import 'core-js/modules/web.dom-collections.iterator';
|
||||
import 'core-js/modules/es.promise';
|
||||
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';
|
@ -65,7 +65,7 @@ import '@angular/localize/init';
|
||||
/***************************************************************************************************
|
||||
* 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
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
// 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 {
|
||||
BrowserDynamicTestingModule,
|
||||
|
@ -7,8 +7,8 @@
|
||||
*/
|
||||
// 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/dist/zone-testing';
|
||||
import 'zone.js';
|
||||
import 'zone.js/testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
|
Loading…
x
Reference in New Issue
Block a user