Skip to content

[heft-sass-plugin] Fix resolution of plain .css files imported via @use / @import#5824

Open
bartvandenende-wm wants to merge 2 commits into
microsoft:mainfrom
bartvandenende-wm:bartvandenende-wm/5823
Open

[heft-sass-plugin] Fix resolution of plain .css files imported via @use / @import#5824
bartvandenende-wm wants to merge 2 commits into
microsoft:mainfrom
bartvandenende-wm:bartvandenende-wm/5823

Conversation

@bartvandenende-wm
Copy link
Copy Markdown
Contributor

Summary

Fixes #5823

Since @rushstack/heft-sass-plugin v0.17.0, a plain .css file referenced from another stylesheet via @use (or @import) could no longer be resolved, even though the file existed and dart-sass supports loading plain CSS. Builds failed with Can't find stylesheet to import. This restores the behavior from v0.16.0 and earlier.

Details

The importer rewrite in #5140 took over all resolution, but its candidate logic only considered .sass/.scss. A .css URL therefore fell through and probed nonexistent paths like tokens.css.scss.

This change makes the importer resolve .css the same way dart-sass does:

  • An explicit .css extension now resolves to the literal file.
  • Extensionless imports also fall back to .css (and /index.css), in Sass's
    preference order (.scss.sass.css).

How it was tested

Added unit tests covering @use of a plain .css file both with an explicit extension and extensionless, asserting the import resolves and the CSS rules are inlined into the output. All existing tests continue to pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

[heft-sass-plugin] Importer cannot resolve plain .css files referenced via @use / @import

1 participant