Skip to content

Vite HMR blank page when editing __root.tsx (Solid SSR) #6331

@yanghuidong

Description

@yanghuidong

Which project does this relate to?

Router

Describe the bug

Editing __root.tsx triggers HMR but renders blank page with client error:

Warning: template2 is not a function

Server-side stack trace:

RunnerError
  at reviveInvokeError (vite/dist/node/module-runner.js:476:64)
  at Object.invoke (vite/dist/node/module-runner.js:549:11)
  at ModuleRunner.getModuleInformation (vite/dist/node/module-runner.js:1086:7)
  at request (vite/dist/node/module-runner.js:1103:83)
  at /src/routeTree.gen.ts:11:1              ← import { Route as rootRouteImport } from './routes/__root'
  at ESModulesEvaluator.runInlinedModule (vite/dist/node/module-runner.js:913:3)
  at ModuleRunner.directRequest (vite/dist/node/module-runner.js:1146:59)
  at ModuleRunner.cachedRequest (vite/dist/node/module-runner.js:1053:73)
  at /src/router.tsx:4:1                           ← import { routeTree } from '~/routeTree.gen'
  at ESModulesEvaluator.runInlinedModule (vite/dist/node/module-runner.js:913:3)

status: 500

HMR works correctly on all other route files.

Your Example Website or App

n/a

Steps to Reproduce the Bug or Issue

  1. Create TanStack Start (Solid) app
  2. pnpm dev
  3. Edit __root.tsx (e.g. change some text)
  4. Observe: Blank page, console shows template2 is not a function
  5. Compare: Edit index.tsx → HMR works fine

Expected behavior

Expected: Either successful HMR or graceful full reload
Actual: Blank page requiring manual refresh

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.145.11
  • OS: macOS
  • Browser: Chrome
  • Browser Version: 144.0
  • Bundler: Vite
  • Bundler Version: 7.3.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions