[Bug]: dev server build embedded in a custom server/index bundle keeps a stale, content-addressed browser manifest (0.8.x)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 22/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- express, react, typescript
- Área
- build-system
Línea de trabajo
Start with loadReactRouterServerBuild(devServer) and the server-manifest.json cache under node_modules/.cache/react-router/<hash>/, then compare where the embedded virtual/react-router/server-build manifest is generated relative to the web compilation. Reproduce with the examples/epic-stack layout, checking that the manifest-*.js URL in the SSR HTML matches the one the web environment emits. Done means the embedded and published manifest versions match after source edits, or the docs state the supported server/index setup. The maintainers still have to decide which of the two options in the issue is supported.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Plugin version: 0.8.2 (works on 0.7.2) · @rsbuild/core: 2.2.12 · @rspack/core: 2.2.8 · react-router: 7.18.4
Problem
With pluginReactRouter({ customServer: true }) and a server/index.ts entry that imports virtual/react-router/server-build itself (the layout examples/epic-stack uses), the dev SSR HTML references a browser manifest the dev server does not serve:
<link rel="modulepreload" href="/static/js/manifest-2492e836.js"/>
GET /static/js/manifest-2492e836.js -> 200 text/html (falls through to the SSR handler)
GET /static/js/manifest-6dd56d97.js -> 200 text/javascript
The page never hydrates.
The server build embedded in the static/js/app bundle carries a manifest that was generated before the web compilation finished. Its route css arrays are empty, so its sha256 version differs from the published browser manifest:
static/js/app (server/index.ts) version 2492e836 routes.root.css: []
loadReactRouterServerBuild(devServer) version 6dd56d97 routes.root.css: ["/static/css/root.css.__react_router_css_<hash>.css"]
The embedded copy is never regenerated. It stays at 2492e836 after source edits that rebuild both environments, and after the content of node_modules/.cache/react-router/<hash>/server-manifest.json changes (it holds the correct 6dd56d97 snapshot). loadReactRouterServerBuild(devServer) returns the correct pair the whole time.
0.7.2 used a fixed dev manifest URL (static/js/virtual/react-router/browser-manifest.js?v=...), so the stale embedded copy still loaded. Since #138 (0.8.0), dev manifest filenames are content-addressed, so the mismatch breaks the page.
Reproduction
// server/index.ts (bundled as static/js/app)
import { createRequestHandler } from '@react-router/express';
export const handler = createRequestHandler({
build: () => import('virtual/react-router/server-build'),
});
// server/start.js
const devServer = await rsbuild.createDevServer();
app.use(devServer.middlewares);
app.all('/{*splat}', async (req, res, next) => {
const mod = await devServer.environments.node.loadBundle('static/js/app');
await mod.handler(req, res, next);
});
Start the dev server with an empty node_modules/.cache/react-router, request a page, and compare the manifest-*.js URL in the HTML with the one the web environment emits.
Workaround
Keep the routes and server setup from the server/index bundle, and take assets from the plugin's paired build:
const mod = await devServer.environments.node.loadBundle('static/js/app');
const paired = await loadReactRouterServerBuild(devServer);
// build = { ...embeddedServerBuild, assets: paired.assets }
Using the paired build wholesale isn't an option for us. static/js/react-router-server-build is a separate bundle with its own module instances, so singletons initialized by server/index.ts (a logger, in our case) are uninitialized in the route modules it evaluates.
Question
Which setup is supported for a server/index entry in dev?
server/indexmay importvirtual/react-router/server-build(asexamples/epic-stackdoes), and the embedded manifest should stay paired with the published browser manifest. That makes this a bug.server/indexmust take its build fromloadReactRouterServerBuild(devServer). In that case, is there a way for the paired build to share module instances with theserver/indexbundle, or should the docs say thatserver/indexmust not read its own embedded server build?
- Lenguaje dominante
- TypeScript
- Estrellas
- 145
- Forks
- 13
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin 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 rstackjs/rsbuild-plugin-react-router
-
[Feature]: Support on-demand compilation of SSR dynamic imports without reloading unrelated pagesAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
rstackjs/rsbuild-plugin-react-router#155 · 1 comentario ·
-
blocked
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
rstackjs/rsbuild-plugin-react-router#140 · 1 comentario ·
Todos los issues de rstackjs/rsbuild-plugin-react-router
Issues similares
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
lingdojo/kana-dojo#34664 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
bug: achievement job reports success when its Slack announcements failPosiblemente ocupada @Aadithya-kl la tomó hoy. Abiertoapp: slackbot good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
enhancement help wanted
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
plagor44-ux/liam-e#168 ·
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jerney-nexus/epikrise#364 ·
Los mantenedores suelen responder en 1 día