-
Notifications
You must be signed in to change notification settings - Fork 1.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
Set production
or development
in conditions
#3994
Comments
esbuild doesn't check |
That seems reasonable as |
Can you provide more information? Specifically: What breaks when you don't configure this in esbuild, and for what packages? Marking this issue as |
@evanw It is in I also have a trivial demo using svelte ssr which requires certain configurations to make the dev build work. IMO, it is fine to NOT having this feature implemented because Node.js doesn't change runtime conditions by NODE_ENV too. On the other hand, for the specific package, |
The main problem users will encounter is warnings that they have set neither the Users may also miss out on development warnings if they are running in development and do not set the corresponding condition: |
It would be nice if
conditions
always includeddevelopment
orproduction
E.g.
vite build
will automatically set theproduction
condition whilevite dev
will automatically set thedevelopment
condition. Rollup also sets thedevelopment
andproduction
conditions by default.References:
https://vite.dev/config/shared-options#resolve-conditions
https://vite.dev/guide/env-and-mode#node-env-and-modes
Libraries like Svelte rely on this to be set. This works automatically in Vite and Rollup, but requires extra configuration in esbuild
If the user has not provided either
production
ordevelopment
then setproduction
by default ordevelopment
ifNODE_ENV === 'development'
The text was updated successfully, but these errors were encountered: