Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
});
});