diff --git a/packages/angular/plugins/component-testing.ts b/packages/angular/plugins/component-testing.ts index e3050945da4de..0a9067517db12 100644 --- a/packages/angular/plugins/component-testing.ts +++ b/packages/angular/plugins/component-testing.ts @@ -200,10 +200,15 @@ function normalizeBuildTargetOptions( return polyfill; }; // paths need to be unix paths for angular devkit - buildOptions.polyfills = - Array.isArray(buildOptions.polyfills) && buildOptions.polyfills.length > 0 - ? (buildOptions.polyfills as string[]).map((p) => handlePolyfillPath(p)) - : handlePolyfillPath(buildOptions.polyfills as string); + if (buildOptions.polyfills) { + buildOptions.polyfills = + Array.isArray(buildOptions.polyfills) && + buildOptions.polyfills.length > 0 + ? (buildOptions.polyfills as string[]).map((p) => + handlePolyfillPath(p) + ) + : handlePolyfillPath(buildOptions.polyfills as string); + } buildOptions.main = joinPathFragments(offset, buildOptions.main); buildOptions.index = typeof buildOptions.index === 'string'