diff --git a/packages/angular/build/src/tools/esbuild/application-code-bundle.ts b/packages/angular/build/src/tools/esbuild/application-code-bundle.ts index e59f139c8aeb..257a98fc0f45 100644 --- a/packages/angular/build/src/tools/esbuild/application-code-bundle.ts +++ b/packages/angular/build/src/tools/esbuild/application-code-bundle.ts @@ -654,9 +654,13 @@ function getEsBuildCommonPolyfillsOptions( tryToResolvePolyfillsAsRelative: boolean, loadResultCache: LoadResultCache | undefined, ): BuildOptions | undefined { - const { jit, workspaceRoot, i18nOptions, externalPackages } = options; + const { jit, workspaceRoot, i18nOptions } = options; - const buildOptions = getEsBuildCommonOptions(options); + const buildOptions = getEsBuildCommonOptions({ + ...options, + externalPackages: false, + }); + buildOptions.packages = 'bundle'; buildOptions.splitting = false; buildOptions.plugins ??= []; @@ -671,10 +675,8 @@ function getEsBuildCommonPolyfillsOptions( // Locale data should go first so that project provided polyfill code can augment if needed. let needLocaleDataPlugin = false; if (i18nOptions.shouldInline) { - if (!externalPackages) { - // Remove localize polyfill when i18n inline transformation have been applied to all the packages. - polyfills = polyfills.filter((path) => !path.startsWith('@angular/localize')); - } + // Remove localize polyfill when i18n inline transformation have been applied to all the packages. + polyfills = polyfills.filter((path) => !path.startsWith('@angular/localize')); // Add locale data for all active locales // TODO: Inject each individually within the inlining process itself