Skip to content

Commit f309516

Browse files
alan-agius4filipesilva
authored andcommitted
refactor(@angular-devkit/build-angular): drop support for zone.js 0.10
BREAKING CHANGE: Minimum supported `zone.js` version is `0.11.4`
1 parent bb38f85 commit f309516

File tree

10 files changed

+14
-33
lines changed

10 files changed

+14
-33
lines changed

integration/angular_cli/src/environments/environment.ts

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

integration/angular_cli/src/polyfills.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
/***************************************************************************************************
5656
* Zone JS is required by default for Angular itself.
5757
*/
58-
import 'zone.js/dist/zone'; // Included with Angular CLI.
58+
import 'zone.js'; // Included with Angular CLI.
5959

6060

6161
/***************************************************************************************************

integration/angular_cli/src/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
22

3-
import 'zone.js/dist/zone-testing';
3+
import 'zone.js/testing';
44
import { getTestBed } from '@angular/core/testing';
55
import {
66
BrowserDynamicTestingModule,

packages/angular_devkit/build_angular/src/browser/specs/differential_loading_spec.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,9 @@ describe('Browser Builder with differential loading', () => {
184184

185185
it('uses the right zone.js variant', async () => {
186186
const { files } = await browserBuild(architect, host, target, { optimization: false });
187-
expect(await files['polyfills-es5.js']).toContain('zone.js/dist/zone-legacy');
187+
expect(await files['polyfills-es5.js']).toContain('zone.js/plugins/zone-legacy');
188188
expect(await files['polyfills-es5.js']).toContain('registerElementPatch');
189-
expect(await files['polyfills-es5.js']).toContain('zone.js/dist/zone-evergreen');
190-
expect(await files['polyfills-es2015.js']).toContain('zone.js/dist/zone-evergreen');
191-
expect(await files['polyfills-es2015.js']).not.toContain('zone.js/dist/zone-legacy');
189+
expect(await files['polyfills-es2015.js']).not.toContain('zone.js/plugins/zone-legacy');
192190
expect(await files['polyfills-es2015.js']).not.toContain('registerElementPatch');
193191
});
194192

packages/angular_devkit/build_angular/src/utils/webpack-browser-config.ts

-17
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,6 @@ export async function generateWebpackConfig(
6868

6969
const webpackConfig = webpackMerge(webpackPartialGenerator(wco));
7070

71-
if (supportES2015) {
72-
if (!webpackConfig.resolve) {
73-
webpackConfig.resolve = {};
74-
}
75-
if (Array.isArray(webpackConfig.resolve.alias)) {
76-
webpackConfig.resolve.alias.push({
77-
alias: 'zone.js/dist/zone',
78-
name: 'zone.js/dist/zone-evergreen',
79-
});
80-
} else {
81-
if (!webpackConfig.resolve.alias) {
82-
webpackConfig.resolve.alias = {};
83-
}
84-
webpackConfig.resolve.alias['zone.js/dist/zone'] = 'zone.js/dist/zone-evergreen';
85-
}
86-
}
87-
8871
if (profilingEnabled) {
8972
const esVersionInFileName = getEsVersionForFileName(
9073
tsConfig.options.target,

packages/angular_devkit/build_angular/src/webpack/configs/common.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
9191
if (buildBrowserFeatures.isEs5SupportNeeded()) {
9292
const polyfillsChunkName = 'polyfills-es5';
9393
entryPoints[polyfillsChunkName] = [path.join(__dirname, '..', 'es5-polyfills.js')];
94-
if (differentialLoadingMode) {
95-
// Add zone.js legacy support to the es5 polyfills
96-
// This is a noop execution-wise if zone-evergreen is not used.
97-
entryPoints[polyfillsChunkName].push('zone.js/dist/zone-legacy');
9894

95+
if (differentialLoadingMode) {
9996
// Since the chunkFileName option schema does not allow the function overload, add a plugin
10097
// that changes the name of the ES5 polyfills chunk to not include ES2015.
10198
extraPlugins.push({

packages/angular_devkit/build_angular/src/webpack/es5-polyfills.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,7 @@ import 'core-js/modules/web.dom-collections.iterator';
111111
import 'core-js/modules/es.promise';
112112
import 'core-js/modules/es.json.to-string-tag';
113113

114-
import 'regenerator-runtime/runtime';
114+
import 'regenerator-runtime/runtime';
115+
116+
// Zone.js
117+
import 'zone.js/plugins/zone-legacy';

packages/angular_devkit/build_angular/test/hello-world-app/src/polyfills.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import '@angular/localize/init';
6565
/***************************************************************************************************
6666
* Zone JS is required by default for Angular itself.
6767
*/
68-
import 'zone.js/dist/zone'; // Included with Angular CLI.
68+
import 'zone.js'; // Included with Angular CLI.
6969

7070
/***************************************************************************************************
7171
* APPLICATION IMPORTS

packages/angular_devkit/build_angular/test/hello-world-app/src/test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
99

10-
import 'zone.js/dist/zone-testing';
10+
import 'zone.js/testing';
1111
import { getTestBed } from '@angular/core/testing';
1212
import {
1313
BrowserDynamicTestingModule,

packages/angular_devkit/build_angular/test/hello-world-lib/projects/lib/src/test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
99

10-
import 'zone.js/dist/zone';
11-
import 'zone.js/dist/zone-testing';
10+
import 'zone.js';
11+
import 'zone.js/testing';
1212
import { getTestBed } from '@angular/core/testing';
1313
import {
1414
BrowserDynamicTestingModule,

0 commit comments

Comments
 (0)