@@ -778,7 +778,7 @@ class WebpackCLI {
778778 return { options, path : configPath } ;
779779 } ;
780780
781- const evaluateConfig = async ( loadedConfig , args ) => {
781+ const evaluateConfig = async ( loadedConfig , argv ) => {
782782 const isMultiCompiler = Array . isArray ( loadedConfig . options ) ;
783783 const config = isMultiCompiler ? loadedConfig . options : [ loadedConfig . options ] ;
784784
@@ -791,7 +791,7 @@ class WebpackCLI {
791791 // `Promise` may return `Function`
792792 if ( typeof rawConfig === 'function' ) {
793793 // when config is a function, pass the env from args to the config function
794- rawConfig = await rawConfig ( args . env , args ) ;
794+ rawConfig = await rawConfig ( argv . env , argv ) ;
795795 }
796796
797797 return rawConfig ;
@@ -824,7 +824,7 @@ class WebpackCLI {
824824
825825 const loadedConfig = await loadConfig ( configPath ) ;
826826
827- return evaluateConfig ( loadedConfig , options ) ;
827+ return evaluateConfig ( loadedConfig , options . argv || { } ) ;
828828 } ) ,
829829 ) ;
830830
@@ -867,7 +867,7 @@ class WebpackCLI {
867867
868868 if ( foundDefaultConfigFile ) {
869869 const loadedConfig = await loadConfig ( foundDefaultConfigFile . path ) ;
870- const evaluatedConfig = await evaluateConfig ( loadedConfig , options ) ;
870+ const evaluatedConfig = await evaluateConfig ( loadedConfig , options . argv || { } ) ;
871871
872872 config . options = evaluatedConfig . options ;
873873
@@ -1275,7 +1275,9 @@ class WebpackCLI {
12751275 : undefined ;
12761276
12771277 // TODO webpack@4 doesn't support `{ children: [{ colors: true }, { colors: true }] }` for stats
1278- if ( compiler . compilers && ! compiler . compilers . find ( oneOfCompiler => oneOfCompiler . webpack ) ) {
1278+ const statsForWebpack4 = webpack . Stats && webpack . Stats . presetToOptions ;
1279+
1280+ if ( compiler . compilers && statsForWebpack4 ) {
12791281 statsOptions . colors = statsOptions . children . some ( ( child ) => child . colors ) ;
12801282 }
12811283
@@ -1311,7 +1313,7 @@ class WebpackCLI {
13111313 }
13121314 } ;
13131315
1314- options . env = { WEBPACK_BUNDLE : true , ...options . env } ;
1316+ options . argv = { ... options , env : { WEBPACK_BUNDLE : true , ...options . env } } ;
13151317
13161318 compiler = await this . createCompiler ( options , callback ) ;
13171319
0 commit comments