Skip to content

Commit

Permalink
feat(@angular-devkit/build-angular): use evergreen version of zone.js…
Browse files Browse the repository at this point in the history
… with ES2015
  • Loading branch information
clydin authored and alexeagle committed Apr 25, 2019
1 parent e3a36c4 commit 5b4b78b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,17 @@ export async function generateWebpackConfig(
wco.buildOptions.progress = defaultProgress(wco.buildOptions.progress);

const partials = webpackPartialGenerator(wco);
const webpackConfig = webpackMerge(partials);
const webpackConfig = webpackMerge(partials) as webpack.Configuration;

if (supportES2015) {
if (!webpackConfig.resolve) {
webpackConfig.resolve = {};
}
if (!webpackConfig.resolve.alias) {
webpackConfig.resolve.alias = {};
}
webpackConfig.resolve.alias['zone.js/dist/zone'] = 'zone.js/dist/zone-evergreen';
}

if (options.profile || process.env['NG_BUILD_PROFILING']) {
const esVersionInFileName = getEsVersionForFileName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,13 @@ describe('Browser Builder with differential loading', () => {
expect(await files['main-es5.js']).not.toContain('class');
expect(await files['main-es2015.js']).toContain('class');
});

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');
expect(await files['polyfills-es5.js']).not.toContain('zone.js/dist/zone-evergreen');
expect(await files['polyfills-es5.js']).toContain('registerElementPatch');
expect(await files['polyfills-es2015.js']).toContain('zone.js/dist/zone-evergreen');
expect(await files['polyfills-es2015.js']).not.toContain('registerElementPatch');
});
});

0 comments on commit 5b4b78b

Please sign in to comment.