Sass exports patterns within npm modules are not acknowledged by Angular's sass-resolvers with the use of @use
at-rule
#29784
Labels
needs: repro steps
We cannot reproduce the issue with the information given
Command
serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Given the following within a module's package.json, Angular's sass resolvers aren't working as expected with patterns defined in
export
objects with the use of@use
/@import
as expected with new Angular application breaking the principle of least surprise for Sass authors of all levels.package.json
src/styles.scss
Expected Output
Both sass files are loaded
Actual Output
The
index.scss
file will load as expected but not the individual Sass modules within the same package written as-is unlike how the use of@use
and@import
is documented by the Sass programming language and the behavior of other sass resolvers historically–this includes [Sass's built-in package importer].Instead, Angular sass resolvers force the sass files to be explicitly defined contrary to the intent of the sass glob patterns unlike other Sass resolvers (including sass's native
pkg:
npm package resolver) or import sass modules prefixed with_
:OR
I'm of the opinion this breaks the principle of least surprise for Sass authors of all levels, including even AI agents attempting to follow the spirit of how Sass modules are supposed to be work within the language's documentation and the documentation + bug issue of the langauge's built-in package manager.
Proposed Solutions
Angular sass-resolvers better respect export glob patterns associated with Sass
Angular default Sass module for all preset build variants (
application
,browser
, andbrowser-esbuild
goes ahead and support by default Sass's built-in package importer–or at minimum support the@use pkg:<module>
syntax.Sass's built-in package import is stable for some time now (at least about a year); it seems like an unnecessary or fruitless endeavor in 2025 for Angular dev tools to insist on a proprietary way for devs and/or sass stylesheet stakeholders to load Sass files in a new Angular application moving forward.
The use of Sass's built-in package import would resolve the issue consistent with other envrionments that support modern Sass as the following:
Minimal Reproduction
Issue occurs with any attempt to build or run an Angualr app with this intended use of modules beyond the index sass file of a NPM Package consisting of Sass files
For example commands such as
npm serve
,npm build
and so on.Exception or Error
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: