@@ -22,13 +22,17 @@ const CODE_GENERATION_RESULT = {
2222 * @type WeakMap<webpack, CssModule>
2323 */
2424const cssModuleCache = new WeakMap ( ) ;
25+ /**
26+ * @type WeakMap<webpack, CssDependency>
27+ */
28+ const cssDependencyCache = new WeakMap ( ) ;
2529
2630class MiniCssExtractPlugin {
2731 static getCssModule ( webpack ) {
2832 /**
2933 * Prevent creation of multiple CssModule classes to allow other integrations to get the current CssModule.
3034 */
31- if ( cssModuleCache . has ( webpack ) ) {
35+ if ( cssModuleCache . has ( webpack ) ) {
3236 return cssModuleCache . get ( webpack ) ;
3337 }
3438 class CssModule extends webpack . Module {
@@ -194,6 +198,12 @@ class MiniCssExtractPlugin {
194198 }
195199
196200 static getCssDependency ( webpack ) {
201+ /**
202+ * Prevent creation of multiple CssDependency classes to allow other integrations to get the current CssDependency.
203+ */
204+ if ( cssDependencyCache . has ( webpack ) ) {
205+ return cssDependencyCache . get ( webpack ) ;
206+ }
197207 // eslint-disable-next-line no-shadow
198208 class CssDependency extends webpack . Dependency {
199209 constructor (
@@ -244,6 +254,8 @@ class MiniCssExtractPlugin {
244254 }
245255 }
246256
257+ cssDependencyCache . set ( webpack , CssDependency ) ;
258+
247259 if (
248260 webpack . util &&
249261 webpack . util . serialization &&
0 commit comments