solidjs / solidjs/filesystem-routing

Serialized lazy-ref `src` values contain backslashes

Open Beginner friendly
#6 1 comment 1 reaction 0 assignees View on GitHub

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

  1. 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()] });
    
  2. Build the client bundle:

    npx vite build
    
  3. 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
      ...
    }
    
  4. Compare against Vite's client manifest keys (src/routes/index.tsx?..., always posix). No key matches, hydration preload misses, server lazy() 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.