From 3a3a9b1e8707171aa3cdfa5af6a3c553821e5f11 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Wed, 30 Apr 2025 10:54:21 -0400 Subject: [PATCH] fix(@schematics/angular): avoid empty polyfill option for new zoneless application To reduce the size of the initial `angular.json` for applications, newly generated zoneless applications will no longer contain an explicit empty `polyfills` option. The option can still be added and is available for use if needed by an application but the empty array value will no longer be present when generating a zoneless application. This has no effect for applications using Zone.js (default). --- packages/schematics/angular/application/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/schematics/angular/application/index.ts b/packages/schematics/angular/application/index.ts index e84c5ba7a121..5e9f379aed5e 100644 --- a/packages/schematics/angular/application/index.ts +++ b/packages/schematics/angular/application/index.ts @@ -258,7 +258,7 @@ function addAppToWorkspaceFile( options: { index: `${sourceRoot}/index.html`, browser: `${sourceRoot}/main.ts`, - polyfills: options.zoneless ? [] : ['zone.js'], + polyfills: options.zoneless ? undefined : ['zone.js'], tsConfig: `${projectRoot}tsconfig.app.json`, inlineStyleLanguage, assets: [{ 'glob': '**/*', 'input': `${projectRoot}public` }], @@ -297,7 +297,7 @@ function addAppToWorkspaceFile( : { builder: Builders.BuildKarma, options: { - polyfills: options.zoneless ? [] : ['zone.js', 'zone.js/testing'], + polyfills: options.zoneless ? undefined : ['zone.js', 'zone.js/testing'], tsConfig: `${projectRoot}tsconfig.spec.json`, inlineStyleLanguage, assets: [{ 'glob': '**/*', 'input': `${projectRoot}public` }],