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 diff --git a/packages/plugin-rsc/src/plugin.ts b/packages/plugin-rsc/src/plugin.ts index ba546297a..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,10 +1616,16 @@ 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) // 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; ` }