[plugin-rsc] With two dev servers in one process, loadModule runs in the last server's environment
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 57/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript, vite
Línea de trabajo
Start in the plugin-rsc package, where each server's configureServer sets globalThis.__VITE_ENVIRONMENT_RUNNER_IMPORT__, and trace how import.meta.viteRsc.loadModule chooses the runner. Use the linked reproduction's repro.mjs to check behavior with two middleware mode servers, including after one closes. Done means each server's loadModule uses its own environment and continues working when the other server closes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Related plugins
Describe the bug
Written with the help of an AI coding agent (Claude); reproduced locally.
Each dev server's configureServer sets globalThis.__VITE_ENVIRONMENT_RUNNER_IMPORT__ to a function bound to that server, and nothing resets it on close. With two servers in one process (e.g. tests), import.meta.viteRsc.loadModule in server A goes through server B:
server A, alone: app a, evaluated by server A
server A, B started: app a, evaluated by server B
server B: app b, evaluated by server B
server A, after B closed: Error: Vite module runner has been closed.
evaluatedBy is set through each server's define, so A's ssr entry is evaluated in B's ssr environment, and A fails once B closes.
Reproduction
https://github.com/Sheraff/vite-plugin-rsc-two-dev-servers
Steps to reproduce
npm install
npm run repro
repro.mjs creates two middleware-mode servers (app-a, app-b, rsc({ serverHandler: false }), different define), and in each calls an rsc-entry function that does:
const ssr = await import.meta.viteRsc.loadModule('ssr', 'index')
return `app ${ssr.appName}, evaluated by ${ssr.evaluatedBy}`
Expected: evaluated by server A for every call on server A, and no error after server B closes.
A possible fix: key the dev runner import by server (an id in the transform output, falling back to the documented global when a framework overrides it), or at least restore the previous value when a server closes.
System Info
System:
OS: Linux 6.12 Debian GNU/Linux 13 (trixie) 13 (trixie)
CPU: (32) x64 AMD Ryzen 9 9955HX 16-Core Processor
Memory: 41.36 GB / 60.50 GB
Container: Yes
Shell: 5.2.37 - /bin/bash
Binaries:
Node: 26.12.1 - ~/.local/share/pnpm/bin/node
npm: 12.2.0 - ~/.local/share/pnpm/bin/npm
pnpm: 12.11.2 - ~/.local/share/pnpm/bin/pnpm
npmPackages:
@vitejs/plugin-rsc: 0.5.39 => 0.5.39
react: 19.3.1 => 19.3.1
react-dom: 19.3.1 => 19.3.1
vite: 8.4.0 => 8.4.0
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.2k
- Forks
- 287
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 21
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de vitejs/vite-plugin-react
-
plugin-rsc: a client reference's CSS is linked before the CSS of the chunks it imports (build)Posiblemente ocupada @wozhenbang2004 la tomó hace 7 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
vitejs/vite-plugin-react#1570 ·
Los mantenedores suelen responder en 1 día
-
pending triage
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
vitejs/vite-plugin-react#1581 ·
Los mantenedores suelen responder en 1 día
-
[plugin-rsc] Build exits 0, but the app fails at runtime: a server action imported only by browser code is missing from the RSC buildPosiblemente ocupada @NeilPant la tomó hace 4 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
vitejs/vite-plugin-react#1578 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
vitejs/vite-plugin-react#1577 ·
Los mantenedores suelen responder en 1 día
-
[plugin-rsc] inline "use server" function declarations lose hoisting and throw TDZ ReferenceErrorPosiblemente ocupada @draarivpatel-ui la tomó hace 3 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
vitejs/vite-plugin-react#1566 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de vitejs/vite-plugin-react
Issues similares
-
bug from-app needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nightly-labs/openbot#18462 ·
Los mantenedores suelen responder en 1 día
-
Fast and light shell approval "Always allow" button shows raw English backticks and scrambles commands in ArabicPosiblemente ocupada @tylerbea la tomó hoy. Abiertoagent-ui bug p3
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
amd/gaia#9236 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug] Windows: Ctrl+C / Ctrl+V not working in chat input boxPosiblemente ocupada @PranavTJ-05 la tomó hoy. Abiertocomp/desktop desktop/chat desktop/shell os/windows P2 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
NousResearch/hermes-agent#161023 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Resources: New templates ofAbiertoresources
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
railmapgen/rmg-templates#2703 ·
Los mantenedores suelen responder en 1 día
-
TypeScript OSS: `huggingfaceBaseUrl` is dropped by config validation, so the documented HuggingFace embedder example throwsPosiblemente ocupada @jaisogani-ai la tomó hoy. Abiertobug sdk-typescript
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
mem0ai/mem0#8068 · 2 comentarios ·
Los mantenedores suelen responder en 1 día