`@vitejs/plugin-rsc` build fails on Vite 8.0.8 with Deno 2.7
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- deno, react, typescript, vite
- Domain
- build-system, tooling
Research direction
Start with @vitejs/plugin-rsc's virtual:vite-rsc/assets-manifest handling and the Vite 8/Rolldown Environment API, then reproduce the failure with gleez/deno-rsc-starter. Compare the Vite 7 and Vite 8 build paths; done means vite build succeeds on Vite 8.0.8 with Deno 2.7 without the external workaround plugins.
Written by the indexing model from the issue text.
Description
Related plugins
Describe the bug
Environment
- Vite:
7.x→ 8.0.8 (regression) @vitejs/plugin-rsc:0.5.23- Runtime: Deno 2.7
The build fails only during vite build (dev mode works fine) with the following error:
[plugin rsc:virtual:vite-rsc/assets-manifest]
AssertionError: The expression evaluated to a falsy value:
assert(this.environment.mode === "dev")
AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
assert(this.environment.mode === "dev")
Root Cause
Vite 8 switched to Rolldown (Rust-based bundler) and introduced changes to the Environment API and virtual module handling. This exposed two issues in @vitejs/plugin-rsc:
- Virtual modules prefixed with
virtual:vite-rsc/are not properly recognized by Rolldown unless they are explicitly prefixed with the standard\0(null byte) convention. - The
assets-manifestvirtual plugin still reaches the strictassert(this.environment.mode === "dev")during production builds, even though the plugin contains logic to treat it asexternal: truein build mode.
Required Workarounds
To make builds succeed on Vite 8 + Deno 2.7, we currently need these two patches (placed early in the plugins array, before rsc()):
Patch 1: virtual-rsc-scheme-fix.ts (fixes virtual module resolution - in dev and build)
import type { Plugin } from 'vite';
export function virtualRscSchemeFix(): Plugin {
return {
name: 'virtual-rsc-scheme-fix',
enforce: 'pre' as const,
resolveId(id: string) {
if (id.startsWith('virtual:vite-rsc/')) {
return '\0' + id; // Standard virtual module prefix for Rolldown/Vite
}
},
};
}
Patch 2: fix-rsc-assets-manifest-build.ts (forces correct build behavior)
import { Plugin } from 'vite';
export function fixRscAssetsManifestBuild(): Plugin {
return {
name: 'fix-rsc-assets-manifest-build',
enforce: 'pre' as const,
resolveId(source) {
if (source === 'virtual:vite-rsc/assets-manifest') {
if (this.environment?.mode === 'build') {
return { id: source, external: true };
}
}
},
};
}
Plugin order is very sensitive — moving these patches earlier in the array (or changing the order of other plugins) can make the build succeed or fail.
Additional Context
- Uses a full multi-environment setup (
rsc,ssr,client) with@deno/vite-plugin. - Worked reliably on Vite 7.
- The combination of Rolldown’s stricter virtual module handling + Deno’s npm compatibility layer appears to trigger the issue more easily.
Reproduction
Steps to reproduce
No response
System Info
Vite: 7.x → 8.0.8 (regression)
@vitejs/plugin-rsc: 0.5.23
Runtime: Deno 2.7
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 287
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 19
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vitejs/vite-plugin-react
-
plugin-rsc: a client reference's CSS is linked before the CSS of the chunks it imports (build)Possibly taken @wozhenbang2004 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
vitejs/vite-plugin-react#1570 ·
Maintainers usually reply within 1 day
-
pending triage
Difficulty 4/5 3-5 days Newbie friendliness 35/100
vitejs/vite-plugin-react#1581 ·
Maintainers usually reply within 1 day
-
[plugin-rsc] Build exits 0, but the app fails at runtime: a server action imported only by browser code is missing from the RSC buildPossibly taken @NeilPant claimed this 4 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
vitejs/vite-plugin-react#1578 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
vitejs/vite-plugin-react#1577 ·
Maintainers usually reply within 1 day
-
[plugin-rsc] inline "use server" function declarations lose hoisting and throw TDZ ReferenceErrorPossibly taken @draarivpatel-ui claimed this 2 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
vitejs/vite-plugin-react#1566 · 1 comment ·
Maintainers usually reply within 1 day
All issues in vitejs/vite-plugin-react
Similar issues
-
good first issue help wanted
Difficulty 2/5 Under an hour Newbie friendliness 86/100
Intelligenza-Umana/intelligenza-umana-web#16 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-webui/open-webui#35184 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
danielmiessler/LifeOS#3001 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day