File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,9 +112,13 @@ function setupHooks(context) {
112112 const [ firstCompiler ] =
113113 /** @type {MultiCompiler } */
114114 ( compiler ) . compilers ;
115+
116+ // TODO remove `colorette` and set minimum supported webpack version is `5.101.0`
115117 childStatsOptions . colors =
118+ typeof firstCompiler . webpack !== "undefined" &&
119+ typeof firstCompiler . webpack . cli !== "undefined" &&
116120 typeof firstCompiler . webpack . cli . isColorSupported ===
117- "function"
121+ "function"
118122 ? firstCompiler . webpack . cli . isColorSupported ( )
119123 : require ( "colorette" ) . isColorSupported ;
120124 }
@@ -128,14 +132,13 @@ function setupHooks(context) {
128132 ) ;
129133
130134 if ( typeof statsOptions . colors === "undefined" ) {
135+ const { compiler } = /** @type {{ compiler: Compiler } } */ ( context ) ;
131136 // TODO remove `colorette` and set minimum supported webpack version is `5.101.0`
132137 statsOptions . colors =
133- typeof (
134- /** @type {Compiler } */
135- ( context . compiler ) . webpack . cli . isColorSupported
136- ) === "function"
137- ? /** @type {Compiler } */
138- ( context . compiler ) . webpack . cli . isColorSupported ( )
138+ typeof compiler . webpack !== "undefined" &&
139+ typeof compiler . webpack . cli !== "undefined" &&
140+ typeof compiler . webpack . cli . isColorSupported === "function"
141+ ? compiler . webpack . cli . isColorSupported ( )
139142 : require ( "colorette" ) . isColorSupported ;
140143 }
141144 }
You can’t perform that action at this time.
0 commit comments