Skip to content

fix(@angular/build): set resolveDir for inline component stylesheets in StylesheetPluginFactory - #34418

Closed
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/inline-stylesheet-resolvedir
Closed

alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix/inline-stylesheet-resolvedir

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Summary

  • Set resolveDir: dirname(filename) on the OnLoadResult returned by StylesheetPluginFactory for namespace: 'angular:styles/component', matching the fallback plain-CSS handler in component-stylesheets.ts. This ensures relative url() and @import references in inline SCSS/Sass/Less (or inline CSS when PostCSS/Tailwind is active) resolve relative to the component directory instead of receiving resolveDir = "".
  • Parse args.path safely using const [format, , ...rest] = args.path.split(';'); const filename = rest.join(';'); so file or directory paths containing semicolons are not truncated.

Testing

  • Added unit tests in stylesheet-plugin-factory_spec.ts verifying resolveDir and semicolon preservation in StylesheetPluginFactory as well as relative url('./asset.svg') resolution in inline SCSS via ComponentStylesheetBundler.

…in StylesheetPluginFactory

Ensure inline component stylesheets processed by StylesheetPluginFactory (such as inline SCSS/Sass/Less or inline CSS with PostCSS/Tailwind) return resolveDir set to the component file's directory so relative url() and @import references resolve against the component directory. Also preserve semicolons in component file paths when parsing angular:styles/component entry paths.
@alan-agius4
alan-agius4 deleted the fix/inline-stylesheet-resolvedir branch October 20, 2026 09:09
@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Nov 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant