Skip to content

fix(@angular/build): support quotes in styles and polyfills paths - #34391

Open
MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:fix/quoted-global-entry-paths
Open

MeAkib wants to merge 1 commit into
angular:mainfrom
MeAkib:fix/quoted-global-entry-paths

Conversation

@MeAkib

@MeAkib MeAkib commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

The application builder generated the global styles and polyfills entry modules by wrapping each configured path in single quotes without escaping. A path containing a single quote, such as src/dev's theme/theme.css, produced an invalid import and the build failed with "Could not resolve" or a syntax error.

Generate the import specifiers with JSON.stringify so that such paths are quoted correctly.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes an issue where file paths containing single quotes (such as src/dev's polyfills/polyfills.js) caused build failures when generating polyfill and global style imports. The fix replaces single-quoted string interpolation with JSON.stringify to safely escape paths in the generated import statements. Additionally, corresponding unit tests have been added to verify this behavior for both polyfills and global styles. There are no review comments to address, and the changes look solid.

Comment thread packages/angular/build/src/builders/application/tests/options/polyfills_spec.ts Outdated
Comment thread packages/angular/build/src/tools/esbuild/application-code-bundle.ts
@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: patch This PR is targeted for the next patch release labels Oct 19, 2026
@MeAkib
MeAkib requested a review from alan-agius4 October 19, 2026 08:30
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Oct 19, 2026
The application builder generated the global styles and polyfills entry modules by
wrapping each configured path in single quotes without escaping. A path containing a
single quote, such as `src/dev's theme/theme.css`, produced an invalid import and the
build failed with "Could not resolve" or a syntax error.

Generate the import specifiers with `JSON.stringify` so that such paths are quoted
correctly.
@alan-agius4
alan-agius4 force-pushed the fix/quoted-global-entry-paths branch from 4754d8f to 87464b4 Compare October 19, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants