remix icon indicating copy to clipboard operation
remix copied to clipboard

Multiple remix dev servers in one express application

Open Mordred opened this issue 1 year ago • 0 comments

Reproduction

https://github.com/Mordred/multi-remix

npm install
node server.js

Open https://localhost:3000/admin/ and https://localhost:3000/blog/

System Info

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 88.30 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.0 - /usr/local/bin/node
    npm: 10.2.4 - /usr/local/bin/npm
    Watchman: 2024.05.06.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 126.0.6478.183
    Edge: 126.0.2592.113
    Safari: 17.5
  npmPackages:
    @remix-run/express: 2.10.3 => 2.10.3
    vite: 5.3.4 => 5.3.4

Used Package Manager

npm

Expected Behavior

Both routes should be working correctly

Actual Behavior

One route is throwing error, because server-runtime is using globally set dev server hook, so it is impossible to have two (or more) remix apps in one project.

https://github.com/remix-run/remix/blob/main/packages/remix-server-runtime/dev.ts#L41 https://github.com/remix-run/remix/blob/main/packages/remix-dev/vite/plugin.ts#L1317

Second dev server is rewriting hook for the first one which will then crash.

Mordred avatar Jul 20 '24 18:07 Mordred