solidjs / solidjs/filesystem-routing
Serialized lazy-ref `src` values contain backslashes
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 19
- Forks
- 4
- Avg merge
- 1m
- Merged PRs (30d)
- 4
Description
Summary
On Windows OS, the fileRoutes() Vite plugin serializes lazy route refs with
backslashed src values (produced by node:path relative()), while Vite's
client manifest keys are always forward slashes. The two never match, so SSR
hydration preloads silently miss and SolidJS server lazy() breaks.
Steps to reproduce
-
On Windows, create a minimal app that actually runs the plugin through Vite:
dummy-app/ ├── package.json ├── vite.config.ts └── src/routes/index.tsx -> export default () => <h1>Home</h1>;// vite.config.ts import { fileRoutes } from "filesystem-routing/vite"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [fileRoutes()] }); -
Build the client bundle:
npx vite build -
Inspect the emitted route manifest chunk (the module built from
virtual:file-routes):"$component": { "src": "src\\routes\\index.tsx?pick=default&pick=$css&lang.tsx", // <- backslashes ... } -
Compare against Vite's client manifest keys (
src/routes/index.tsx?..., always posix). No key matches, hydration preload misses, serverlazy()never resolves.
Root cause
In src/vite/index.ts, both lazy-ref serializers emit:
src: relative(root, buildId)
node:path.relative() returns platform separators — backslashes on Windows.
Every other path in the pipeline is normalized to posix via normalizePath();
these two call sites were missed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/vite/index.ts and inspect the two lazy-ref serializers that emit src with relative(root, buildId), comparing them with the pipeline's normalizePath() usage. Reproduce the plugin build on Windows and verify that the emitted route manifest uses forward-slash paths matching Vite's client manifest keys.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100