Skip to content

Commit

Permalink
feat: support set NODE_ENV in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed May 19, 2022
1 parent c86329b commit da26930
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/config.ts
Expand Up @@ -395,7 +395,9 @@ export async function resolveConfig(
// Note it is possible for user to have a custom mode, e.g. `staging` where
// production-like behavior is expected. This is indicated by NODE_ENV=production
// loaded from `.staging.env` and set by us as VITE_USER_NODE_ENV
const isProduction = (process.env.VITE_USER_NODE_ENV || mode) === 'production'
const isProduction =
(process.env.NODE_ENV || process.env.VITE_USER_NODE_ENV || mode) ===
'production'
if (isProduction) {
// in case default mode was not production and is overwritten
process.env.NODE_ENV = 'production'
Expand Down

0 comments on commit da26930

Please sign in to comment.