Skip to content

Commit 0e2804a

Browse files
committed
Added option to disable async downloading of CSS
1 parent 826811a commit 0e2804a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ class MiniCssExtractPlugin {
269269
mainTemplate.hooks.requireEnsure.tap(
270270
pluginName,
271271
(source, chunk, hash) => {
272-
console.log('Here is the source in requireEnsure:: ', source);
273-
/*
272+
// if disableAsync option is set, don't fetch css
273+
if (this.options.disableAsync) return null;
274+
274275
const chunkMap = this.getCssChunkObject(chunk);
275276
if (Object.keys(chunkMap).length > 0) {
276277
const chunkMaps = chunk.getChunkMaps();
@@ -390,18 +391,16 @@ class MiniCssExtractPlugin {
390391
'}',
391392
]);
392393
}
393-
*/
394+
394395
return source;
395396
}
396397
);
397398
});
398399
}
399400

400401
getCssChunkObject(mainChunk) {
401-
console.log('Here is the mainChunk:: ', mainChunk);
402402
const obj = {};
403403
for (const chunk of mainChunk.getAllAsyncChunks()) {
404-
console.log('here is the individual chunk:: ', chunk);
405404
for (const module of chunk.modulesIterable) {
406405
if (module.type === MODULE_TYPE) {
407406
obj[chunk.id] = 1;

0 commit comments

Comments
 (0)