Skip to content

Commit 4de8bef

Browse files
authored
fix: set NODE_ENV to production when args.dev is false (#1276)
1 parent 92989b7 commit 4de8bef

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

.changeset/large-bobcats-grab.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@callstack/repack": patch
3+
---
4+
5+
Set NODE_ENV based on args.dev option

packages/repack/src/commands/common/setupEnvironment.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
ASSETS_DEST_ENV_KEY,
33
BUNDLE_FILENAME_ENV_KEY,
4+
NODE_ENV_KEY,
45
RSPACK_RAYON_THREADS_ENV_KEY,
56
RSPACK_TOKIO_THREADS_ENV_KEY,
67
SOURCEMAP_FILENAME_ENV_KEY,
@@ -17,10 +18,12 @@ interface EnvironmentArgs {
1718
assetsDest?: string;
1819
bundleOutput?: string;
1920
sourcemapOutput?: string;
21+
dev?: boolean;
2022
verbose?: boolean;
2123
}
2224

2325
export function setupEnvironment(args: EnvironmentArgs): void {
26+
setEnvVar(NODE_ENV_KEY, args.dev === false ? 'production' : 'development');
2427
setEnvVar(VERBOSE_ENV_KEY, args.verbose ? 'true' : undefined);
2528
setEnvVar(BUNDLE_FILENAME_ENV_KEY, args.bundleOutput);
2629
setEnvVar(SOURCEMAP_FILENAME_ENV_KEY, args.sourcemapOutput);

packages/repack/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export const NODE_ENV_KEY = 'NODE_ENV';
12
export const VERBOSE_ENV_KEY = 'REPACK_VERBOSE';
23
export const WORKER_ENV_KEY = 'REPACK_WORKER';
34

0 commit comments

Comments
 (0)