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

Vite MODE when evaluating routes.ts is production/development, not what’s passed via --mode #12514

Open
fionawhim opened this issue Dec 10, 2024 · 0 comments
Labels

Comments

@fionawhim
Copy link

I'm using React Router as a...

framework

Reproduction

Example repo: https://github.com/fionawhim/rr-mode-bug

(this is based off of create-react-router)

  • npm install, &c.
  • npm run build -- --mode=staging

System Info

System:
    OS: macOS 14.7.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 60.05 MB / 16.00 GB
    Shell: 3.7.1 - /usr/local/bin/fish
  Binaries:
    Node: 18.16.0 - ~/.asdf/installs/nodejs/lts-hydrogen/bin/node
    npm: 9.5.1 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 131.0.6778.109
    Safari: 18.1.1
  npmPackages:
    @react-router/dev: ^7.0.2 => 7.0.2 
    @react-router/node: ^7.0.2 => 7.0.2 
    @react-router/serve: ^7.0.2 => 7.0.2 
    react-router: ^7.0.2 => 7.0.2 
    vite: ^5.4.11 => 5.4.11

Used Package Manager

npm

Expected Behavior

This code console.logs the Vite “mode” in both vite.config.ts and routes.ts.

The --mode set on the command line should be echoed in both places. In this case, each should say “staging”

Actual Behavior

Instead, the Vite mode for routes.ts is always production when doing a build (and development when doing dev server)

MODE FOR VITE CONFIG staging
MODE FOR ROUTES: production
MODE FOR VITE CONFIG staging

The rational here is to have routes that are generated in our staging environment but not our production environment.

@fionawhim fionawhim added the bug label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant