-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix: reset NODE_ENV on production build end #9058
fix: reset NODE_ENV on production build end #9058
Conversation
✅ Deploy Preview for vite-docs-main canceled.
|
@sapphi-red, @bluwy, let me know what you think here. This PR is small enough that we could merge it before the release tomorrow. |
Interesting looks like some tests are checking post-build. I think these tests could be skipped during build 🤔 |
I think we may want to revise I'm not really sure about resetting it like in this PR. It feels like it would open up a can of worms over an existing dilemma. Maybe a better way is to hard-set In the future, we should probably avoid setting |
I think we may need to revise As long as we set But for now, I think we should focus on making the change less breaking. I think going with this PR or reverting #8218 is better. If we are going to change how to handle About this PR's test, I think replacing |
@sapphi-red you have a point, we shoupd avoid breaking twice. I think reverting #8218 may be the best. It should only break the issues it targeted, no? I'm out for a bit, would you like to send a PR and we check with ecosystem ci? Better to send it in the main vite repo instead of your fork so we can test before merging |
@patak-dev Yes, I think it only breaks the targeted issue and there is a workaround (set |
I'm in the boat of not reverting #8218. Ideally we should respect user's |
Ok, we could try both and run ecosystem-ci in both PR. I think we could actually release and then fix this in a patch with more time. Whatever we do now, we are chosing what edge cases to break |
Yep, @bluwy's fix should work for us! Happy to close this 👍 |
Description
Resolves #9057
NODE_ENV
to its initial value when a production build ends. This preventsNODE_ENV
from leaking to subsequent Vite runs.Additional context
It seems this issue was introduced by #8218 (cc @sapphi-red and @bluwy). I'd suggest investigating other options to flip
isProduction
beyond environment variables, since they can easily leak between Vite builds (ex. the parallel CI suites we use at Astro). Perhaps a new CLI flag, or exposingisProduction
as an inline config option separate frommode
?What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).