fix(@angular/build): prepend deploy-url to file loader output paths#32880
fix(@angular/build): prepend deploy-url to file loader output paths#32880maruthang wants to merge 1 commit intoangular:mainfrom
Conversation
Pass the publicPath option through to esbuild's common options so that assets processed by the file loader (e.g., SVGs imported via URL) get the deploy-url prefix applied, matching the previous webpack behavior. Fixes angular#32789
There was a problem hiding this comment.
Code Review
This pull request updates the esbuild configuration to include the publicPath option, ensuring that file loader import URLs correctly prepend the deployment URL. A new test case was added to verify this behavior for file loaders. I have no feedback to provide.
|
Thank you for the contribution. However, these changes affect the entire code bundling process and not just the file loaders. This would need to be handled in a fine-grained manner. But even that type of change may lead to breaking behavior for existing users. Further information is needed from the originating issue regarding a specific use case and reproduction before changes can made. |
|
Thanks for the feedback, @clydin. You're right — esbuild's A more targeted approach would be to modify the I'll close this PR for now. If the issue reporter provides a reproduction, I'm happy to revisit with a fine-grained approach. |
PR Checklist
PR Type
What is the current behavior?
Assets processed by esbuild's file loader (e.g., SVGs imported via
import svgUrl from './test.svg') do not get thedeploy-urlprefix applied. ThepublicPathoption (derived fromdeployUrl) is passed to stylesheet bundling but not to the application code bundler's common options.Issue Number: #32789
What is the new behavior?
Pass
publicPaththrough to esbuild's common options ingetEsBuildCommonOptions(), so file loader output paths are correctly prefixed with the deploy-url value.No regression risk: Component stylesheets already explicitly delete
publicPathbefore their own bundling (lines 72 and 127 incomponent-stylesheets.ts), preventing double-prefixing.Does this PR introduce a breaking change?