@@ -26,7 +26,7 @@ export interface ApplicationBuildOptions {
2626 * @private
2727 * @internal
2828 */
29- function mergeDefinitionsIfNeeded ( env : Record < string , string > ) {
29+ function mergeDefinitionsIfNeeded ( env : Record < string , string > , isDev : boolean ) {
3030 const values = Object . fromEntries (
3131 Object . entries ( process . env ) . filter (
3232 ( [ k ] ) => ! ( k in env ) && k . startsWith ( 'COMMANDKIT_PUBLIC_' ) ,
@@ -36,6 +36,19 @@ function mergeDefinitionsIfNeeded(env: Record<string, string>) {
3636 return {
3737 ...env ,
3838 ...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+ } ) ,
3952 } ;
4053}
4154
@@ -110,7 +123,7 @@ export async function buildApplication({
110123 sourcemap : true ,
111124 target : 'node16' ,
112125 outDir : dest ,
113- env : mergeDefinitionsIfNeeded ( config . env || { } ) ,
126+ env : mergeDefinitionsIfNeeded ( config . env || { } , ! ! isDev ) ,
114127 entry : [
115128 'src' ,
116129 `!${ config . distDir } ` ,
0 commit comments