fix(manifest): use resolved virtual module ID for CSS imports in Vite 8 - #2293
Open
waterWang wants to merge 1 commit into
Open
fix(manifest): use resolved virtual module ID for CSS imports in Vite 8#2293waterWang wants to merge 1 commit into
waterWang wants to merge 1 commit into
Conversation
Virtual CSS modules (e.g. UnoCSS /__uno.css) have dep.file === null and dep.id starting with \0. Using dep.url (e.g. "/__uno.css") in the generated import() fails in Vite 8 module runner with ERR_DENIED_ID because the URL looks like a nonexistent filesystem path. Fix: use dep.id (the resolved virtual module ID, e.g. \0virtual:uno.css) for virtual modules. wrapId() converts it to /@id/__x00__virtual:uno.css, a safe form that Vite's /@id/ resolution plugin can resolve through the plugin pipeline. Real CSS files (dep.file is set) keep using dep.url. Fixes solidjs#2292
|
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
commit: |
Contributor
|
@katywings thoughts on this? |
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.
Description
Virtual CSS modules (e.g. UnoCSS
/__uno.css) havedep.file === nullanddep.idstarting with\0. Usingdep.url(e.g./__uno.css) in the generatedimport()call fails in Vite 8 module runner withERR_DENIED_IDbecause the URL looks like a nonexistent filesystem path.Root Cause
In
findStylesInModuleGraph, the code storesstyles[dep.id] = dep.urlfor all CSS modules. For virtual modules:dep.url=/__uno.css(the URL form, not resolvable as a real file)dep.id=\0virtual:uno.css(the resolved virtual module ID)The generated code does
import("/__uno.css?inline")— Vite 8's module runner rejects this ID because it's neither a real file path nor a\0-prefixed virtual module.Fix
For virtual modules (
dep.file === null), usedep.id(the resolved ID) instead ofdep.url.wrapId()converts\0virtual:uno.cssto/@id/__x00__virtual:uno.css— a safe form that Vite's/@id/resolution plugin can resolve through the plugin pipeline.Real CSS files (
dep.fileis set) keep usingdep.urlas before.Related
Fixes #2292