From a195735d4b1a4af971b8561a10ef0c29d3fc9586 Mon Sep 17 00:00:00 2001 From: James Date: Sun, 3 May 2026 00:49:55 +0100 Subject: [PATCH 1/5] fix(rsc): emit fs proxy for client-in-server package proxy --- packages/plugin-rsc/src/plugin.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/plugin-rsc/src/plugin.ts b/packages/plugin-rsc/src/plugin.ts index ba546297a..bea0095fb 100644 --- a/packages/plugin-rsc/src/plugin.ts +++ b/packages/plugin-rsc/src/plugin.ts @@ -1615,10 +1615,18 @@ function vitePluginUseClient( '\0virtual:vite-rsc/client-in-server-package-proxy/'.length, ), ) + // Route absolute paths through `/@fs/` so import-analysis resolves + // them correctly even when the dependency optimizer doesn't rewrite + // the import to a `?v=` URL (e.g. when reached via a relative + // import from another package file). + const url = normalizeViteImportAnalysisUrl( + this.environment as DevEnvironment, + id, + ) // TODO: avoid `export default undefined` return ` - export * from ${JSON.stringify(id)}; - import * as __all__ from ${JSON.stringify(id)}; + export * from ${JSON.stringify(url)}; + import * as __all__ from ${JSON.stringify(url)}; export default __all__.default; ` } From 0b83849f8dd93e939888dc2496db71e67593f63d Mon Sep 17 00:00:00 2001 From: James Date: Sun, 3 May 2026 00:50:31 +0100 Subject: [PATCH 2/5] remove label req --- .github/workflows/release-continuous.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-continuous.yml b/.github/workflows/release-continuous.yml index f8cb9d2f0..291b8175e 100644 --- a/.github/workflows/release-continuous.yml +++ b/.github/workflows/release-continuous.yml @@ -14,7 +14,7 @@ jobs: if: > github.repository == 'vitejs/vite-plugin-react' && (github.event_name == 'push' || - (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'trigger: preview'))) + (github.event_name == 'pull_request')) runs-on: ubuntu-latest steps: - name: Checkout code From 07e6f023375613dfced536ebd028d7922ef2ba31 Mon Sep 17 00:00:00 2001 From: James Date: Sun, 3 May 2026 01:03:47 +0100 Subject: [PATCH 3/5] . --- packages/plugin-rsc/src/plugin.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/plugin-rsc/src/plugin.ts b/packages/plugin-rsc/src/plugin.ts index bea0095fb..b82107bab 100644 --- a/packages/plugin-rsc/src/plugin.ts +++ b/packages/plugin-rsc/src/plugin.ts @@ -57,6 +57,7 @@ import { } from './plugins/utils' import { validateImportPlugin } from './plugins/validate-import' import { + FS_PREFIX, cleanUrl, directRequestRE, evalValue, @@ -1615,14 +1616,12 @@ function vitePluginUseClient( '\0virtual:vite-rsc/client-in-server-package-proxy/'.length, ), ) - // Route absolute paths through `/@fs/` so import-analysis resolves - // them correctly even when the dependency optimizer doesn't rewrite - // the import to a `?v=` URL (e.g. when reached via a relative - // import from another package file). - const url = normalizeViteImportAnalysisUrl( - this.environment as DevEnvironment, - id, - ) + // Always emit `/@fs/` so import-analysis resolves the + // module directly from disk. Without this, when this proxy is + // reached via a relative import (so the optimizer doesn't rewrite + // it to a `?v=` URL), import-analysis would treat the raw + // absolute path as a root-relative URL and look up the wrong file. + const url = path.posix.join(FS_PREFIX, id) // TODO: avoid `export default undefined` return ` export * from ${JSON.stringify(url)}; From 80f35cf70a8ac3b009abdfda719be800918672fe Mon Sep 17 00:00:00 2001 From: James Date: Sun, 3 May 2026 01:15:29 +0100 Subject: [PATCH 4/5] . --- packages/plugin-rsc/src/plugin.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/plugin-rsc/src/plugin.ts b/packages/plugin-rsc/src/plugin.ts index b82107bab..95225e486 100644 --- a/packages/plugin-rsc/src/plugin.ts +++ b/packages/plugin-rsc/src/plugin.ts @@ -57,12 +57,12 @@ import { } from './plugins/utils' import { validateImportPlugin } from './plugins/validate-import' import { - FS_PREFIX, cleanUrl, directRequestRE, evalValue, normalizeViteImportAnalysisUrl, prepareError, + wrapId, } from './plugins/vite-utils' import { type TransformWrapExportFilter, @@ -1616,12 +1616,12 @@ function vitePluginUseClient( '\0virtual:vite-rsc/client-in-server-package-proxy/'.length, ), ) - // Always emit `/@fs/` so import-analysis resolves the - // module directly from disk. Without this, when this proxy is - // reached via a relative import (so the optimizer doesn't rewrite - // it to a `?v=` URL), import-analysis would treat the raw - // absolute path as a root-relative URL and look up the wrong file. - const url = path.posix.join(FS_PREFIX, id) + // Wrap the absolute path with `/@id/` so import-analysis treats + // it as an already-resolved id and bypasses the deps optimizer. + // Going through the optimizer would re-normalize the URL and + // (depending on filesystem layout) emit a bare absolute path + // that import-analysis then misresolves as root-relative. + const url = wrapId(id) // TODO: avoid `export default undefined` return ` export * from ${JSON.stringify(url)}; From d06ea9025d4c35c7bef5dc25079665cbd0ed1f5c Mon Sep 17 00:00:00 2001 From: James Date: Sun, 3 May 2026 01:30:02 +0100 Subject: [PATCH 5/5] . --- packages/plugin-rsc/src/plugin.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/plugin-rsc/src/plugin.ts b/packages/plugin-rsc/src/plugin.ts index 95225e486..b82107bab 100644 --- a/packages/plugin-rsc/src/plugin.ts +++ b/packages/plugin-rsc/src/plugin.ts @@ -57,12 +57,12 @@ import { } from './plugins/utils' import { validateImportPlugin } from './plugins/validate-import' import { + FS_PREFIX, cleanUrl, directRequestRE, evalValue, normalizeViteImportAnalysisUrl, prepareError, - wrapId, } from './plugins/vite-utils' import { type TransformWrapExportFilter, @@ -1616,12 +1616,12 @@ function vitePluginUseClient( '\0virtual:vite-rsc/client-in-server-package-proxy/'.length, ), ) - // Wrap the absolute path with `/@id/` so import-analysis treats - // it as an already-resolved id and bypasses the deps optimizer. - // Going through the optimizer would re-normalize the URL and - // (depending on filesystem layout) emit a bare absolute path - // that import-analysis then misresolves as root-relative. - const url = wrapId(id) + // Always emit `/@fs/` so import-analysis resolves the + // module directly from disk. Without this, when this proxy is + // reached via a relative import (so the optimizer doesn't rewrite + // it to a `?v=` URL), import-analysis would treat the raw + // absolute path as a root-relative URL and look up the wrong file. + const url = path.posix.join(FS_PREFIX, id) // TODO: avoid `export default undefined` return ` export * from ${JSON.stringify(url)};