File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -29,18 +29,20 @@ export class RspackCLI {
2929 }
3030 async createCompiler (
3131 options : RspackCLIOptions ,
32- rspackEnv : Command ,
32+ rspackCommand : Command ,
3333 callback ?: ( e : Error , res ?: Stats | MultiStats ) => void
3434 ) : Promise < Compiler | MultiCompiler > {
3535 process . env . RSPACK_CONFIG_VALIDATE = "loose" ;
3636 let nodeEnv = process ?. env ?. NODE_ENV ;
37+ let rspackCommandDefaultEnv =
38+ rspackCommand === "build" ? "production" : "development" ;
3739 if ( typeof options . nodeEnv === "string" ) {
3840 process . env . NODE_ENV = nodeEnv || options . nodeEnv ;
3941 } else {
40- process . env . NODE_ENV = nodeEnv || rspackEnv ;
42+ process . env . NODE_ENV = nodeEnv || rspackCommandDefaultEnv ;
4143 }
4244 let config = await this . loadConfig ( options ) ;
43- config = await this . buildConfig ( config , options , rspackEnv ) ;
45+ config = await this . buildConfig ( config , options , rspackCommand ) ;
4446
4547 const isWatch = Array . isArray ( config )
4648 ? ( config as MultiRspackOptions ) . some ( i => i . watch )
You can’t perform that action at this time.
0 commit comments