Skip to content
Merged
9 changes: 8 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ const CODE_GENERATION_RESULT = {
runtimeRequirements: new Set(),
};

const cssModuleCache = new WeakMap();

class MiniCssExtractPlugin {
static getCssModule(webpack) {
if(cssModuleCache.has(webpack)) {
return cssModuleCache.get(webpack);
}
class CssModule extends webpack.Module {
constructor({
context,
Expand Down Expand Up @@ -133,7 +138,9 @@ class MiniCssExtractPlugin {
super.deserialize(context);
}
}


cssModuleCache.set(webpack, CssModule);

if (
webpack.util &&
webpack.util.serialization &&
Expand Down