File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ import {
5757} from './plugins/utils'
5858import { validateImportPlugin } from './plugins/validate-import'
5959import {
60+ FS_PREFIX ,
6061 cleanUrl ,
6162 directRequestRE ,
6263 evalValue ,
@@ -1615,14 +1616,12 @@ function vitePluginUseClient(
16151616 '\0virtual:vite-rsc/client-in-server-package-proxy/' . length ,
16161617 ) ,
16171618 )
1618- // Route absolute paths through `/@fs/` so import-analysis resolves
1619- // them correctly even when the dependency optimizer doesn't rewrite
1620- // the import to a `?v=<hash>` URL (e.g. when reached via a relative
1621- // import from another package file).
1622- const url = normalizeViteImportAnalysisUrl (
1623- this . environment as DevEnvironment ,
1624- id ,
1625- )
1619+ // Always emit `/@fs/<abs-path>` so import-analysis resolves the
1620+ // module directly from disk. Without this, when this proxy is
1621+ // reached via a relative import (so the optimizer doesn't rewrite
1622+ // it to a `?v=<hash>` URL), import-analysis would treat the raw
1623+ // absolute path as a root-relative URL and look up the wrong file.
1624+ const url = path . posix . join ( FS_PREFIX , id )
16261625 // TODO: avoid `export default undefined`
16271626 return `
16281627 export * from ${ JSON . stringify ( url ) } ;
You can’t perform that action at this time.
0 commit comments