Skip to content

Commit 5b4b78b

Browse files
clydinalexeagle
authored andcommittedApr 25, 2019
feat(@angular-devkit/build-angular): use evergreen version of zone.js with ES2015
1 parent e3a36c4 commit 5b4b78b

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
 

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

+11-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,17 @@ export async function generateWebpackConfig(
9595
wco.buildOptions.progress = defaultProgress(wco.buildOptions.progress);
9696

9797
const partials = webpackPartialGenerator(wco);
98-
const webpackConfig = webpackMerge(partials);
98+
const webpackConfig = webpackMerge(partials) as webpack.Configuration;
99+
100+
if (supportES2015) {
101+
if (!webpackConfig.resolve) {
102+
webpackConfig.resolve = {};
103+
}
104+
if (!webpackConfig.resolve.alias) {
105+
webpackConfig.resolve.alias = {};
106+
}
107+
webpackConfig.resolve.alias['zone.js/dist/zone'] = 'zone.js/dist/zone-evergreen';
108+
}
99109

100110
if (options.profile || process.env['NG_BUILD_PROFILING']) {
101111
const esVersionInFileName = getEsVersionForFileName(

‎packages/angular_devkit/build_angular/test/browser/differential_loading_spec_large.ts

+9
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,13 @@ describe('Browser Builder with differential loading', () => {
9898
expect(await files['main-es5.js']).not.toContain('class');
9999
expect(await files['main-es2015.js']).toContain('class');
100100
});
101+
102+
it('uses the right zone.js variant', async () => {
103+
const { files } = await browserBuild(architect, host, target, { optimization: false });
104+
expect(await files['polyfills-es5.js']).toContain('zone.js/dist/zone');
105+
expect(await files['polyfills-es5.js']).not.toContain('zone.js/dist/zone-evergreen');
106+
expect(await files['polyfills-es5.js']).toContain('registerElementPatch');
107+
expect(await files['polyfills-es2015.js']).toContain('zone.js/dist/zone-evergreen');
108+
expect(await files['polyfills-es2015.js']).not.toContain('registerElementPatch');
109+
});
101110
});

0 commit comments

Comments
 (0)
Please sign in to comment.