Skip to content

Commit 3b477be

Browse files
authored
feat(gatsby-cli): Apply production node env to gatsby serve (#35693)
1 parent 54832b4 commit 3b477be

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/gatsby-cli/src/create-cli.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,13 @@ function buildLocalCommands(cli: yargs.Argv, isLocalSite: boolean): void {
311311
describe: `Tracer configuration file (OpenTracing compatible). See https://gatsby.dev/tracing`,
312312
}),
313313

314-
handler: getCommandHandler(`serve`),
314+
handler: getCommandHandler(
315+
`serve`,
316+
(args: yargs.Arguments, cmd: (args: yargs.Arguments) => void) => {
317+
process.env.NODE_ENV = process.env.NODE_ENV || `production`
318+
return cmd(args)
319+
}
320+
),
315321
})
316322

317323
cli.command({

0 commit comments

Comments
 (0)