File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -112,9 +112,13 @@ function setupHooks(context) {
112
112
const [ firstCompiler ] =
113
113
/** @type {MultiCompiler } */
114
114
( compiler ) . compilers ;
115
+
116
+ // TODO remove `colorette` and set minimum supported webpack version is `5.101.0`
115
117
childStatsOptions . colors =
118
+ typeof firstCompiler . webpack !== "undefined" &&
119
+ typeof firstCompiler . webpack . cli !== "undefined" &&
116
120
typeof firstCompiler . webpack . cli . isColorSupported ===
117
- "function"
121
+ "function"
118
122
? firstCompiler . webpack . cli . isColorSupported ( )
119
123
: require ( "colorette" ) . isColorSupported ;
120
124
}
@@ -128,14 +132,13 @@ function setupHooks(context) {
128
132
) ;
129
133
130
134
if ( typeof statsOptions . colors === "undefined" ) {
135
+ const { compiler } = /** @type {{ compiler: Compiler } } */ ( context ) ;
131
136
// TODO remove `colorette` and set minimum supported webpack version is `5.101.0`
132
137
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 ( )
139
142
: require ( "colorette" ) . isColorSupported ;
140
143
}
141
144
}
You can’t perform that action at this time.
0 commit comments