|
3 | 3 | import { validate } from 'schema-utils';
|
4 | 4 |
|
5 | 5 | import schema from './plugin-options.json';
|
6 |
| -import { MODULE_TYPE, compareModulesByIdentifier, provideLoaderContext } from './utils'; |
| 6 | +import { |
| 7 | + MODULE_TYPE, |
| 8 | + compareModulesByIdentifier, |
| 9 | + provideLoaderContext, |
| 10 | +} from './utils'; |
7 | 11 |
|
8 | 12 | export const pluginName = 'mini-css-extract-plugin';
|
9 | 13 | export const pluginSymbol = Symbol(pluginName);
|
@@ -31,8 +35,8 @@ const cssDependencyCache = new WeakMap();
|
31 | 35 | class MiniCssExtractPlugin {
|
32 | 36 | static getCssModule(webpack) {
|
33 | 37 | /**
|
34 |
| - * Prevent creation of multiple CssModule classes to allow other integrations to get the current CssModule. |
35 |
| - */ |
| 38 | + * Prevent creation of multiple CssModule classes to allow other integrations to get the current CssModule. |
| 39 | + */ |
36 | 40 | if (cssModuleCache.has(webpack)) {
|
37 | 41 | return cssModuleCache.get(webpack);
|
38 | 42 | }
|
@@ -149,9 +153,9 @@ class MiniCssExtractPlugin {
|
149 | 153 | super.deserialize(context);
|
150 | 154 | }
|
151 | 155 | }
|
152 |
| - |
| 156 | + |
153 | 157 | cssModuleCache.set(webpack, CssModule);
|
154 |
| - |
| 158 | + |
155 | 159 | if (
|
156 | 160 | webpack.util &&
|
157 | 161 | webpack.util.serialization &&
|
@@ -200,8 +204,8 @@ class MiniCssExtractPlugin {
|
200 | 204 |
|
201 | 205 | static getCssDependency(webpack) {
|
202 | 206 | /**
|
203 |
| - * Prevent creation of multiple CssDependency classes to allow other integrations to get the current CssDependency. |
204 |
| - */ |
| 207 | + * Prevent creation of multiple CssDependency classes to allow other integrations to get the current CssDependency. |
| 208 | + */ |
205 | 209 | if (cssDependencyCache.has(webpack)) {
|
206 | 210 | return cssDependencyCache.get(webpack);
|
207 | 211 | }
|
@@ -385,10 +389,15 @@ class MiniCssExtractPlugin {
|
385 | 389 | const CssModule = MiniCssExtractPlugin.getCssModule(webpack);
|
386 | 390 | const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack);
|
387 | 391 |
|
388 |
| - provideLoaderContext(compiler, `${pluginName} loader context`, (loaderContext)=>{ |
389 |
| - // eslint-disable-next-line no-param-reassign |
390 |
| - loaderContext[pluginSymbol] = true; |
391 |
| - }, false) |
| 392 | + provideLoaderContext( |
| 393 | + compiler, |
| 394 | + `${pluginName} loader context`, |
| 395 | + (loaderContext) => { |
| 396 | + // eslint-disable-next-line no-param-reassign |
| 397 | + loaderContext[pluginSymbol] = true; |
| 398 | + }, |
| 399 | + false |
| 400 | + ); |
392 | 401 |
|
393 | 402 | compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
|
394 | 403 | class CssModuleFactory {
|
@@ -1126,7 +1135,9 @@ class MiniCssExtractPlugin {
|
1126 | 1135 |
|
1127 | 1136 | if (typeof chunkGroup[moduleIndexFunctionName] === 'function') {
|
1128 | 1137 | // Store dependencies for modules
|
1129 |
| - const moduleDependencies = new Map(modulesList.map((m) => [m, new Set()])); |
| 1138 | + const moduleDependencies = new Map( |
| 1139 | + modulesList.map((m) => [m, new Set()]) |
| 1140 | + ); |
1130 | 1141 | const moduleDependenciesReasons = new Map(
|
1131 | 1142 | modulesList.map((m) => [m, new Map()])
|
1132 | 1143 | );
|
|
0 commit comments