@@ -13,6 +13,10 @@ const isProductionLikeMode = options => {
13
13
return options . mode === "production" || ! options . mode ;
14
14
} ;
15
15
16
+ const isWebLikeTarget = options => {
17
+ return options . target === "web" || options . target === "webworker" ;
18
+ } ;
19
+
16
20
class WebpackOptionsDefaulter extends OptionsDefaulter {
17
21
constructor ( ) {
18
22
super ( ) ;
@@ -166,25 +170,16 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
166
170
this . set ( "node.__filename" , "mock" ) ;
167
171
this . set ( "node.__dirname" , "mock" ) ;
168
172
169
- this . set (
170
- "performance" ,
171
- "make" ,
172
- options => ( isProductionLikeMode ( options ) ? false : undefined )
173
- ) ;
174
- this . set ( "performance" , "call" , value => {
175
- if ( typeof value === "boolean" ) {
176
- return value ;
173
+ this . set ( "performance" , "make" , options => {
174
+ if ( isWebLikeTarget ( options ) && isProductionLikeMode ( options ) ) {
175
+ return { } ;
177
176
} else {
178
- return Object . assign ( { } , value ) ;
177
+ return false ;
179
178
}
180
179
} ) ;
181
180
this . set ( "performance.maxAssetSize" , 250000 ) ;
182
181
this . set ( "performance.maxEntrypointSize" , 250000 ) ;
183
- this . set (
184
- "performance.hints" ,
185
- "make" ,
186
- options => ( isProductionLikeMode ( options ) ? "warning" : false )
187
- ) ;
182
+ this . set ( "performance.hints" , "warning" ) ;
188
183
189
184
this . set ( "optimization.removeAvailableModules" , true ) ;
190
185
this . set ( "optimization.removeEmptyChunks" , true ) ;
0 commit comments