fix(config)!: support development build#11045
Conversation
|
Why do we need a restriction on not using production |
|
We're not supporting production |
benmccann
left a comment
There was a problem hiding this comment.
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 |
patak-cat
left a comment
There was a problem hiding this comment.
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 👍🏼
benmccann
left a comment
There was a problem hiding this comment.
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_ENVby default regardless ofmode. Since Vite only supportsNODE_ENV=productionin.envfiles, 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=developmentonly. Allowing development builds.Additional context
Context: Previously in Vite 3, if the user sets
--mode staging, it builds in developmentNODE_ENVwhich wasn't a nice default so #10996 changed it.I didn't add support for
NODE_ENV=productionas it doesn't make sense in most case. It's only useful fordevcommand, but productionNODE_ENVtypically 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).