diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts index 732ba0853a..bf4b69862b 100644 --- a/packages/cli/src/commands/build.ts +++ b/packages/cli/src/commands/build.ts @@ -3,6 +3,7 @@ import { resolve } from 'path' import { requireModule } from '../utils/cjs' export async function invoke (args) { + process.env.NODE_ENV = process.env.NODE_ENV || 'production' const rootDir = resolve(args._[0] || '.') const { loadNuxt, buildNuxt } = requireModule('@nuxt/kit', rootDir) diff --git a/packages/cli/src/commands/dev.ts b/packages/cli/src/commands/dev.ts index 111933165c..b8cab48c2a 100644 --- a/packages/cli/src/commands/dev.ts +++ b/packages/cli/src/commands/dev.ts @@ -8,6 +8,7 @@ import { error, info } from '../utils/log' import { diff, printDiff } from '../utils/diff' export async function invoke (args) { + process.env.NODE_ENV = process.env.NODE_ENV || 'development' const server = createServer() const listener = await server.listen({ clipboard: true, open: true })