@@ -26,7 +26,7 @@ export interface ApplicationBuildOptions {
26
26
* @private
27
27
* @internal
28
28
*/
29
- function mergeDefinitionsIfNeeded ( env : Record < string , string > ) {
29
+ function mergeDefinitionsIfNeeded ( env : Record < string , string > , isDev : boolean ) {
30
30
const values = Object . fromEntries (
31
31
Object . entries ( process . env ) . filter (
32
32
( [ k ] ) => ! ( k in env ) && k . startsWith ( 'COMMANDKIT_PUBLIC_' ) ,
@@ -36,6 +36,19 @@ function mergeDefinitionsIfNeeded(env: Record<string, string>) {
36
36
return {
37
37
...env ,
38
38
...values ,
39
+ ...( isDev
40
+ ? {
41
+ NODE_ENV : 'development' ,
42
+ COMMANDKIT_BOOTSTRAP_MODE : 'development' ,
43
+ COMMANDKIT_IS_DEV : 'true' ,
44
+ COMMANDKIT_IS_TEST : 'false' ,
45
+ }
46
+ : {
47
+ NODE_ENV : 'production' ,
48
+ COMMANDKIT_BOOTSTRAP_MODE : 'production' ,
49
+ COMMANDKIT_IS_DEV : 'false' ,
50
+ COMMANDKIT_IS_TEST : 'false' ,
51
+ } ) ,
39
52
} ;
40
53
}
41
54
@@ -110,7 +123,7 @@ export async function buildApplication({
110
123
sourcemap : true ,
111
124
target : 'node16' ,
112
125
outDir : dest ,
113
- env : mergeDefinitionsIfNeeded ( config . env || { } ) ,
126
+ env : mergeDefinitionsIfNeeded ( config . env || { } , ! ! isDev ) ,
114
127
entry : [
115
128
'src' ,
116
129
`!${ config . distDir } ` ,
0 commit comments