Skip to content

Commit

Permalink
Merge pull request #865 from chromaui/tom/ap-3897-force-production-en…
Browse files Browse the repository at this point in the history
…vironment-in-cli-builds

Force `NODE_ENV=production` for Storybook builds through the CLI
  • Loading branch information
ghengeveld authored Dec 1, 2023
2 parents 34eeb0e + 86f7878 commit 7873bb4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion node-src/tasks/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export const buildStorybook = async (ctx: Context) => {
ctx.log.debug('Running build command:', ctx.buildCommand);
ctx.log.debug('Runtime metadata:', JSON.stringify(ctx.runtimeMetadata, null, 2));

const subprocess = execaCommand(ctx.buildCommand, { stdio: [null, logFile, logFile], signal });
const subprocess = execaCommand(ctx.buildCommand, {
stdio: [null, logFile, logFile],
signal,
env: { NODE_ENV: 'production' },
});
await Promise.race([subprocess, timeoutAfter(ctx.env.STORYBOOK_BUILD_TIMEOUT)]);
} catch (e) {
signal?.throwIfAborted();
Expand Down

0 comments on commit 7873bb4

Please sign in to comment.