-
-
Notifications
You must be signed in to change notification settings - Fork 8k
[plugin-react] Alpha crashes when setting NODE_ENV in .env file #10854
Copy link
Copy link
Closed
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
I tried upgrading my app to the alpha versions, and found that it was crashing in my staging environment.
I use vite build --mode=staging, and set the NODE_ENV=production in a file named .env.staging. This seems to result in a mixup of production and non-production modes in the react plugin, and I get an error in my browser console:
index.f694439e.js:7690 Uncaught TypeError: jsxDEV is not a function
Ping @rtsao, I guess this check might be happening before .env files are taken into consideration? https://github.com/vitejs/vite/pull/9590/files#r940780633
Reproduction
https://stackblitz.com/edit/vitejs-vite-usasym?file=.env.staging,package.json&terminal=repro
Steps to reproduce
No response
System Info
System:
OS: macOS 12.5.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 65.91 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.12.1 - ~/.nvm/versions/node/v16.14.2/bin/npm
Browsers:
Brave Browser: 107.1.45.116
Firefox: 106.0.5
Safari: 15.6.1
npmPackages:
@vitejs/plugin-react: ^3.0.0-alpha.0 => 3.0.0-alpha.0
vite: ^4.0.0-alpha.0 => 4.0.0-alpha.0Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)