-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Properly initialize NODE_ENV
if not already set
#12578
Conversation
🦋 Changeset detectedLatest commit: 096be72 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🤖 Hello there, We just published version Thanks! |
@brophdawg11 I believe this line breaks the case where extra args are used, like: My traceback: > react-router dev --host
C:\Users\hash\Desktop\xxxx\node_modules\.pnpm\arg@5.0.2\node_modules\arg\index.js:132
throw new ArgError(
^
ArgError: unknown or unexpected option: --host
at arg (C:\Users\hash\Desktop\taup\node_modules\.pnpm\arg@5.0.2\node_modules\arg\index.js:132:13)
at Object.<anonymous> (C:\Users\hash\Desktop\taup\node_modules\.pnpm\@react-router+dev@7.1.0-pre.0_@react-router+serve@7.1.0-pre.0_react-router@7.1.0-pre.0_react-_mucta3rnhylaso2md7vpehy4fa\node_modules\@react-router\dev\bin.js:8:12)
at Module._compile (node:internal/modules/cjs/loader:1566:14)
at Object..js (node:internal/modules/cjs/loader:1718:10)
at Module.load (node:internal/modules/cjs/loader:1305:32)
at Function._load (node:internal/modules/cjs/loader:1119:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:151:5)
at node:internal/main/run_main_module:33:47 {
code: 'ARG_UNKNOWN_OPTION'
} |
🤖 Hello there, We just published version Thanks! |
See #12606 which claims this is the root cause for breaking arg parsing. |
It seems React 19 is a bit more strict with
NODE_ENV
and when it's not set by the user there is currently a mismatch between our code and React's code (similar to the issue in #12078)production
when we callvite.resolveConfig
in inplugin.ts
development
This mismatch causes issues because we end up with mismatched versions of React in the bundle versus the
react-router build
runtime.This PR updates the
react-router
andreact-router-serve
to setNODE_ENV
accordingly if it's not already set:react-router dev
defaults todevelopment
react-router *
commands default toproduction
react-router-serve
defaults toproduction
Closes #12138, #12078