autoCodeSplitting: imported component used as both component and pendingComponent is left undefined (ReferenceError)
Los mantenedores suelen responder en 1 día
@Sheraff ya está trabajando en esto.
Desde el 25/10/2026.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 67/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript, vite
- Área
- build-system
Línea de trabajo
Start in the router plugin’s auto code splitting transform, which handles route component imports; the issue does not name a source file or test. Reproduce with the examples/react/start-bare route and inspect the built server and client router chunks for the missing Page binding. Done when the imported component remains correctly bound when used as both component and pendingComponent, and the route runs without a ReferenceError.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Which project does this relate to?
Start
Describe the bug
With autoCodeSplitting: true, a component that is imported from another module and used as both component and pendingComponent ends up as a free identifier in the built router chunk.
component becomes lazyRouteComponent($$splitComponentImporter, "component"), pendingComponent: Page stays in the main chunk, and the import { Page } is removed. vite build exits 0, but the chunk throws when it is evaluated (server request, or Start prerender):
ReferenceError: Page is not defined
at file:///.../dist/server/assets/router-DsEmb4my.js:40:20
at ModuleJob.run (node:internal/modules/esm/module_job:569:25)
at async node:internal/modules/esm/loader:650:26
at async Promise.all (index 0)
at async loadEntries (file:///.../dist/server/server.js:6766:52)
The client chunk has the same pendingComponent:Page with no binding.
Not affected: a component declared in the route file and used for both keys (it goes to a ?tsr-shared=1 module), and a separate pending component.
// src/routes/about.tsx
import { createFileRoute } from '@tanstack/react-router'
import { Page } from '~/components/Page'
export const Route = createFileRoute('/about')({
loader: () => new Promise((r) => setTimeout(r, 500)),
component: Page,
pendingComponent: Page,
})
Built server chunk:
var Route = createFileRoute("/about")({
loader: () => new Promise((r) => setTimeout(r, 500)),
component: lazyRouteComponent($$splitComponentImporter, "component"),
pendingComponent: Page
});
Workaround: codeSplitGroupings: [['component', 'pendingComponent']] on the route.
Complete minimal reproducer
https://github.com/cpeaustriajc/tanstack-router-shared-pending-component-repro
Steps to Reproduce the Bug
The repo is examples/react/start-bare with src/routes/about.tsx changed and src/components/Page.tsx added.
pnpm installpnpm vite buildgrep -n pendingComponent dist/server/assets/router-*.jsshowspendingComponent: Page, and the chunk has no import or declaration ofPage.pnpm startand open/about:ReferenceError: Page is not defined.
Control: change to pendingComponent: () => <p>Loading</p>. The build output has no free identifier and /about renders.
Expected behavior
The import stays in the main chunk while pendingComponent (not split) still references it, or the binding is shared the same way as a component declared in the route file.
Screenshots or Videos
No response
Platform
- Router / Start Version: @tanstack/react-router 1.170.46, @tanstack/react-start 1.169.5, @tanstack/router-plugin 1.169.0, @tanstack/start-plugin-core 1.171.56 (also seen on router-plugin 1.168.48)
- OS: macOS
- Browser: n/a (fails on the server)
- Browser Version: n/a
- Bundler: vite
- Bundler Version: 8.3.6
- Node: 26.12.1
Additional context
This issue was written with an AI assistant (Claude) and checked by running the reproducer from a fresh clone.
- Lenguaje dominante
- TypeScript
- Estrellas
- 15.3k
- Forks
- 1.9k
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 46
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- 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 TanStack/router
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Masked navigation drops the first character of the hash each time (__tempLocation hash missing '#')Posiblemente ocupada @hassanabrar202 la tomó hace 8 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
router-generator: lazy-load Prettier (costs ~300–450ms per build even when formatting is off)Posiblemente ocupada @Sheraff la tomó hace 27 días. Abiertopackage: router-generator performance
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
router-generator: sibling `physical()` subtrees in a virtual route config generate duplicate identifiersPosiblemente ocupada @Sheraff la tomó hace 27 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
docs(router): clarify static title fallback in SPA modePosiblemente ocupada @Rohan-Dedhia la tomó hace 17 días. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/router
Issues similares
-
[BUG]: Shared links drop the configured basePath on GitHub PagesPosiblemente ocupada @anshulchikhale30-p la tomó hoy. Abiertobug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
StabilityNexus/IdentityTokens-EVM-Frontend#182 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Add: GTrekkerAbiertocheck:passed streams:add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Koenkk/zigbee-herdsman-converters#13900 ·
Los mantenedores suelen responder en 1 día
-
area: ui Bug Payload OSS
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
payloadcms/payload#19839 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
jeanibarz/knowledge-base-mcp-server#1291 ·
Los mantenedores suelen responder en 1 día