Skip to content

fix(@angular/build): handle esbuild-browser polyfills option as string during ng serve #27696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2024
Merged
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 @@ -248,7 +248,12 @@ export async function* serveWithVite(
const { root = '' } = await context.getProjectMetadata(projectName);
const projectRoot = join(context.workspaceRoot, root as string);
const browsers = getSupportedBrowsers(projectRoot, context.logger);

const target = transformSupportedBrowsersToTargets(browsers);
// Needed for browser-esbuild as polyfills can be a string.
const polyfills = Array.isArray((browserOptions.polyfills ??= []))
? browserOptions.polyfills
: [browserOptions.polyfills];

// Setup server and start listening
const serverConfiguration = await setupServer(
Expand All @@ -260,7 +265,7 @@ export async function* serveWithVite(
!!browserOptions.ssr,
prebundleTransformer,
target,
isZonelessApp(browserOptions.polyfills),
isZonelessApp(polyfills),
browserOptions.loader as EsbuildLoaderOption | undefined,
extensions?.middleware,
transformers?.indexHtml,
Expand Down
Loading