@@ -177,6 +177,10 @@ class MiniCssExtractPlugin {
177
177
) ;
178
178
}
179
179
180
+ if ( module [ `${ MODULE_TYPE } /disableExtract` ] ) {
181
+ return ;
182
+ }
183
+
180
184
const identifierCountMap = new Map ( ) ;
181
185
182
186
for ( const line of content ) {
@@ -206,8 +210,7 @@ class MiniCssExtractPlugin {
206
210
pluginName ,
207
211
( result , { chunk } ) => {
208
212
const renderedModules = Array . from ( chunk . modulesIterable ) . filter (
209
- ( module ) =>
210
- module . type === MODULE_TYPE && ! moduleToBeRebuild . has ( module )
213
+ ( module ) => module . type === MODULE_TYPE
211
214
) ;
212
215
213
216
if ( renderedModules . length > 0 ) {
@@ -236,8 +239,7 @@ class MiniCssExtractPlugin {
236
239
pluginName ,
237
240
( result , { chunk } ) => {
238
241
const renderedModules = Array . from ( chunk . modulesIterable ) . filter (
239
- ( module ) =>
240
- module . type === MODULE_TYPE && ! moduleToBeRebuild . has ( module )
242
+ ( module ) => module . type === MODULE_TYPE
241
243
) ;
242
244
243
245
if ( renderedModules . length > 0 ) {
@@ -305,7 +307,7 @@ class MiniCssExtractPlugin {
305
307
const { mainTemplate } = compilation ;
306
308
307
309
mainTemplate . hooks . localVars . tap ( pluginName , ( source , chunk ) => {
308
- const chunkMap = this . getCssChunkObject ( chunk , compilation ) ;
310
+ const chunkMap = this . getCssChunkObject ( chunk ) ;
309
311
310
312
if ( Object . keys ( chunkMap ) . length > 0 ) {
311
313
return Template . asString ( [
@@ -326,7 +328,7 @@ class MiniCssExtractPlugin {
326
328
mainTemplate . hooks . requireEnsure . tap (
327
329
pluginName ,
328
330
( source , chunk , hash ) => {
329
- const chunkMap = this . getCssChunkObject ( chunk , compilation ) ;
331
+ const chunkMap = this . getCssChunkObject ( chunk ) ;
330
332
331
333
if ( Object . keys ( chunkMap ) . length > 0 ) {
332
334
const chunkMaps = chunk . getChunkMaps ( ) ;
@@ -499,25 +501,21 @@ class MiniCssExtractPlugin {
499
501
shouldDisableExtract ( { module, isAsync } ) {
500
502
const { disableExtract } = this . options ;
501
503
let shouldDisable = false ;
502
- if ( disableExtract === true ) {
503
- shouldDisable = true ;
504
- } else if ( typeof disableExtract === 'function' ) {
504
+ if ( typeof disableExtract === 'function' ) {
505
505
shouldDisable = disableExtract ( { module, isAsync } ) ;
506
506
}
507
507
508
508
return shouldDisable ;
509
509
}
510
510
511
- getCssChunkObject ( mainChunk , compilation ) {
511
+ getCssChunkObject ( mainChunk ) {
512
512
const obj = { } ;
513
513
514
514
for ( const chunk of mainChunk . getAllAsyncChunks ( ) ) {
515
515
for ( const module of chunk . modulesIterable ) {
516
516
if ( module . type === MODULE_TYPE ) {
517
- if ( ! compilation [ MODULE_TYPE ] . moduleToBeRebuild . has ( module ) ) {
518
- obj [ chunk . id ] = 1 ;
519
- break ;
520
- }
517
+ obj [ chunk . id ] = 1 ;
518
+ break ;
521
519
}
522
520
}
523
521
}
0 commit comments