Skip to content

Commit 07e6f02

Browse files
committed
.
1 parent 0b83849 commit 07e6f02

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

packages/plugin-rsc/src/plugin.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import {
5757
} from './plugins/utils'
5858
import { validateImportPlugin } from './plugins/validate-import'
5959
import {
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)};

0 commit comments

Comments
 (0)