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,12 +57,12 @@ import {
5757} from './plugins/utils'
5858import { validateImportPlugin } from './plugins/validate-import'
5959import {
60+ FS_PREFIX ,
6061 cleanUrl ,
6162 directRequestRE ,
6263 evalValue ,
6364 normalizeViteImportAnalysisUrl ,
6465 prepareError ,
65- wrapId ,
6666} from './plugins/vite-utils'
6767import {
6868 type TransformWrapExportFilter ,
@@ -1616,12 +1616,12 @@ function vitePluginUseClient(
16161616 '\0virtual:vite-rsc/client-in-server-package-proxy/' . length ,
16171617 ) ,
16181618 )
1619- // Wrap the absolute path with `/@id/ ` so import-analysis treats
1620- // it as an already-resolved id and bypasses the deps optimizer.
1621- // Going through the optimizer would re-normalize the URL and
1622- // (depending on filesystem layout) emit a bare absolute path
1623- // that import-analysis then misresolves as root-relative.
1624- const url = wrapId ( id )
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 )
16251625 // TODO: avoid `export default undefined`
16261626 return `
16271627 export * from ${ JSON . stringify ( url ) } ;
You can’t perform that action at this time.
0 commit comments