Skip to content

Commit

Permalink
Merge pull request #480 from Maikel-Nait/main
Browse files Browse the repository at this point in the history
allow build script to use existing NODE_ENV value
  • Loading branch information
dilanx authored Mar 4, 2023
2 parents 751c268 + 5f68223 commit 9685d8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/craco/src/scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BaseContext } from '@craco/types';

process.env.NODE_ENV = 'production';
process.env.NODE_ENV = process.env.NODE_ENV || 'production';

import { findArgsFromCli } from '../lib/args';

Expand All @@ -9,7 +9,7 @@ findArgsFromCli();

import { loadCracoConfigAsync } from '../lib/config';
import { build, getCraPaths } from '../lib/cra';
import { overrideWebpackProd } from '../lib/features/webpack/override';
import { overrideWebpackProd, overrideWebpackDev } from '../lib/features/webpack/override';
import { log } from '../lib/logger';
import { validateCraVersion } from '../lib/validate-cra-version';

Expand All @@ -25,6 +25,6 @@ loadCracoConfigAsync(context).then((cracoConfig) => {

context.paths = getCraPaths(cracoConfig);

overrideWebpackProd(cracoConfig, context);
process.env.NODE_ENV === 'production' ? overrideWebpackProd(cracoConfig, context) : overrideWebpackDev(cracoConfig, context);
build(cracoConfig);
});

0 comments on commit 9685d8c

Please sign in to comment.