-
-
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(config)!: support development build #11045
Conversation
Why do we need a restriction on not using production |
We're not supporting production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's just the Vue plugin that breaks, can we move the error there? I'm not sure we need to disallow it for everyone else
That might be a solution too. I guess we could still support |
I imagine people could have some code like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer that we allow NODE_ENV production during dev once we have a real use case. The warning making this a non-feature so people don't start relying on it seems like a safer choice at this point. @bluwy feel free to merge if you are ok with this 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Sounds fine to me. I did have one suggestion to add a comment above to explain it, but otherwise lgtm
If we add a comment, I think we should add a more generic comment, like Blu's message:
|
There were a couple of improvements in the updated version of Vite around decoupling build modes and NODE_ENV: * vitejs/vite#10996 * vitejs/vite#11045 Accordingly, this change: * Consistently uses import.meta.env.MODE to set build mode specific values vs relying on the (previous) behavior around how import.meta.env.PROD was set. * Adds a development environment file so NODE_ENV is set to development for this builds.
import.meta.env.PROD (and DEV) are no longer determited by vite "mode" vitejs/vite#11045
import.meta.env.PROD (and DEV) are no longer determited by vite "mode" vitejs/vite#11045
Description
Followup to #10996. #10996 makes build run in production
NODE_ENV
by default regardless ofmode
. Since Vite only supportsNODE_ENV=production
in.env
files, there's no way for a user to build in developmentNODE_ENV
.This PR removes support for
NODE_ENV=production
, but added support forNODE_ENV=development
only. Allowing development builds.Additional context
Context: Previously in Vite 3, if the user sets
--mode staging
, it builds in developmentNODE_ENV
which wasn't a nice default so #10996 changed it.I didn't add support for
NODE_ENV=production
as it doesn't make sense in most case. It's only useful fordev
command, but productionNODE_ENV
typically don't work well with the dev command.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).