Skip to content

Commit a195735

Browse files
committed
fix(rsc): emit fs proxy for client-in-server package proxy
1 parent 2845b9f commit a195735

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/plugin-rsc/src/plugin.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,10 +1615,18 @@ function vitePluginUseClient(
16151615
'\0virtual:vite-rsc/client-in-server-package-proxy/'.length,
16161616
),
16171617
)
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+
)
16181626
// TODO: avoid `export default undefined`
16191627
return `
1620-
export * from ${JSON.stringify(id)};
1621-
import * as __all__ from ${JSON.stringify(id)};
1628+
export * from ${JSON.stringify(url)};
1629+
import * as __all__ from ${JSON.stringify(url)};
16221630
export default __all__.default;
16231631
`
16241632
}

0 commit comments

Comments
 (0)