Skip to content

Can't server-side render router with lazily loaded components #553

@kaathewisegit

Description

@kaathewisegit

Describe the bug

I'm not sure if that's a bug or if I'm doing something wrong, but when I'm trying to use Route with components loaded via lazy, trying to render it with renderToStringAsync it returns an empty string.

Your Example Website or App

https://github.com/kaathewisegit/solid-ssr-issue

Steps to Reproduce the Bug or Issue

  1. npm install
  2. Run npm run build:ssr or vite build --ssr src/entry-server --outDir dist/server/
  3. run node dist/server/entry-server.js. It will return an empty string

Expected behavior

I expected it to return lazily loaded component. Replacing <Route path="/" component={lazy(() => import("./component"))} /> with an explicit import and <Route path="/" component={Component}/> makes it work correctly.

Platform

  • OS: Alpine Linux 3.24.0_alpha20260127
  • Browser: none, runtime Node.js v24.13.0

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