fix(css): resolve sass partial package imports from file urls#22505
Closed
cjc0013 wants to merge 1 commit into
Closed
fix(css): resolve sass partial package imports from file urls#22505cjc0013 wants to merge 1 commit into
cjc0013 wants to merge 1 commit into
Conversation
4aec5de to
1369f04
Compare
Author
|
Build & Test is now passing on Linux/macOS/Windows after the latest push. The remaining red check is zizmor; from the log it fails while auditing an existing workflow (.github/workflows/issue-close-require.yml) because GitHub returns 403 while listing tags for actions-cool/issues-helper. This PR doesn't touch workflows, so that looks unrelated/transient. |
Member
|
This should be fixed in |
This was referenced May 25, 2026
sapphi-red
added a commit
to rolldown/rolldown
that referenced
this pull request
Jun 5, 2026
…#9546) ## Summary - keep retry-with-prefix specifiers slash-separated for bare deep imports so package exports see keys like `./styles/_mixins` on Windows - preserve the existing path-based prefix behavior for relative and absolute specifiers - add a `viteResolvePlugin` fixture that resolves a Sass partial through package `exports` ## Context This follows the maintainer note in vitejs/vite#22505 that the fix belongs in `viteResolvePlugin` exported from `rolldown/experimental`. Refs vitejs/vite#22294 and vitejs/vite#22505. ## Validation - `git diff --check` - Not run locally: Rust/fixture test suites, because `cargo`, `pnpm`, and `just` are not available in this local environment. --------- Co-authored-by: cjc0013 <cjc0013@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22294.
When Sass uses the modern importer API, it can call
canonicalizewith afile://URL before the raw specifier. For imports like@vite-sass-bug/example/styles/mixins, that first URL looks like a non-existent relative file under the importer directory. Vite currently tries that path and then lets Sass fall through to package resolution, which fails on Windows for package-exported partials because the partial subpath is checked with a backslash.This PR keeps the existing relative-path attempt first. If that misses, it recovers the bare package specifier from the file URL and retries through Vite's Sass resolver. For Sass partials, it also retries the underscore-prefixed partial form so package exports like
./styles/*: { sass: ./dist/styles/*.scss }can resolvestyles/mixinstodist/styles/_mixins.scsson Windows.Added a regression fixture that simulates the Sass file URL canonicalization path for a package-exported partial.
Validation:
git diff --checkpnpm dlx oxfmt@0.51.0 --check packages/vite/src/node/plugins/css.ts packages/vite/src/node/__tests__/plugins/css.spec.tsvite buildfails with./styles\\_mixins is not exported; after applying the same resolver change to the installed Vite package, the original@use '@vite-sass-bug/example/styles/mixins'build passes.I couldn't complete a full local Vite workspace install on this machine because the available D: drive is exFAT and pnpm workspace symlinks fail there, so I kept validation to formatting, diff checks, and the focused Windows repro.