Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading Remix Fails: Server-only module referenced by client ./sessions.server' imported by route 'src/root.tsx' #10353

Open
Ankish76 opened this issue Dec 19, 2024 · 1 comment

Comments

@Ankish76
Copy link

Ankish76 commented Dec 19, 2024

Reproduction

I'm trying to upgrade Remix to latest one, which uses vite plugin. Upgrade fail with error:


Server-only module referenced by client

  './sessions.server' imported by route 'src/root.tsx'

  Remix automatically removes server-code from these exports:
    `loader`, `action`, `headers`

  But other route exports in 'src/root.tsx' depend on './sessions.server'.

exports from ./sessions.server is used inside root loader

old remix version was able to handle this and was not bundling server code to client
but newer one is not able to do so

I have tried creating a vite plugin to resolve .server.ts file for client side code as empty module.
It didn't helped

System Info

System:
    OS: macOS 15.2
    CPU: (8) arm64 Apple M1
    Memory: 161.73 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
    bun: 1.0.3 - ~/.bun/bin/bun
  Browsers:
    Chrome: 131.0.6778.140
    Edge: 131.0.2903.99
    Safari: 18.2
  npmPackages:
    vite: ^6.0.3 => 6.0.3

Used Package Manager

yarn

Expected Behavior

This should not throw error and handle it like old remix was doing.

Actual Behavior

It throws error mentioned above.

@DiederikvandenB
Copy link

DiederikvandenB commented Dec 23, 2024

I was seeing the same error, but it seems to have resolved itself. Possibly because of an rm -rf node_modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants