Skip to content

static assets 404 on Linux when built on Windows (backslash in assetsBuildDirectory) #14950

@juncha9

Description

@juncha9

Reproduction

  1. Run react-router build on Windows
  2. Copy the build/ output to a Linux server
  3. Run react-router-serve ./build/server/index.js on Linux
  4. Open the app in a browser

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 13th Gen Intel(R) Core(TM) i5-13400
    Memory: 25.26 GB / 63.78 GB
  Binaries:
    Node: 24.14.1 - C:\nvm4w\nodejs\node.EXE
    npm: 11.11.0 - C:\nvm4w\nodejs\npm.CMD
  Browsers:
    Chrome: 146.0.7680.167
    Edge: Chromium (145.0.3800.82)
    Internet Explorer: 11.0.22621.3527

Used Package Manager

npm (with nvm, nvm4w)

Expected Behavior

Static assets under /assets/* are served correctly regardless of which OS the build was produced on.

Actual Behavior

All /assets/* requests return 404, and the server logs errors like:

GET /assets/entry.client-DDoeskJb.js 404
Error: No route matches URL "/assets/entry.client-DDoeskJb.js"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions