Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow consumers to access CssModule #703

Merged
merged 13 commits into from Feb 25, 2021
9 changes: 8 additions & 1 deletion src/index.js
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