Skip to content

Commit

Permalink
feat(@schematics/angular): drop polyfills.ts file from new templates
Browse files Browse the repository at this point in the history
With this change we drop the `polyfills.ts` from new application projects and add the polyfills directly in the `angular.json`. This is possible as now the `polyfills` option accept an array of module specifiers.

This change also fixes another open issue (angular#14432) which was caused by the missing polyfills file in the library test setup.

Closes angular#14432
  • Loading branch information
alan-agius4 committed Sep 23, 2022
1 parent e634ff7 commit 1504352
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
// This is because the jasmine functions such as beforeEach/it will not be patched by zone.js since
// jasmine will not be loaded yet, so the ProxyZone will not be there. We have to load zone-testing.js after
// jasmine is ready.
// We could force loading 'zone.js/testing' prior to jasmine by changing the order of scripts in 'karma-context.html'.
// But this has it's own problems as zone.js needs to be loaded prior to jasmine due to patching of timing functions
// See: https://github.com/jasmine/jasmine/issues/1944
// Thus the correct order is zone.js -> jasmine -> zone.js/testing.
const zoneTestingEntryPoint = 'zone.js/testing';
const polyfillsExludingZoneTesting = polyfills.filter((p) => p !== zoneTestingEntryPoint);

Expand Down

0 comments on commit 1504352

Please sign in to comment.