`@vitejs/plugin-rsc` build fails on Vite 8.0.8 with Deno 2.7

Aperta
#1,182 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
deno, react, typescript, vite

Direzione di ricerca

Inizia dalla gestione di virtual:vite-rsc/assets-manifest di @vitejs/plugin-rsc e dalla Vite 8/Rolldown Environment API, quindi riproduci il problema con gleez/deno-rsc-starter. Confronta i percorsi di build di Vite 7 e Vite 8; il lavoro è completato quando vite build riesce con Vite 8.0.8 e Deno 2.7 senza i plugin esterni di workaround.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

pending triage plugin: rsc
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:

  1. 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.
  2. The assets-manifest virtual plugin still reaches the strict assert(this.environment.mode === "dev") during production builds, even though the plugin contains logic to treat it as external: true in 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

gleez/deno-rsc-starter

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
Lingua principale
TypeScript
Stelle
1.2k
Fork
287
Merge medio
1g 17h
PR unite (30g)
19

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vitejs/vite-plugin-react

Tutte le issue di vitejs/vite-plugin-react

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.