File tree 3 files changed +7
-34
lines changed
3 files changed +7
-34
lines changed Original file line number Diff line number Diff line change 3
3
import { validate } from 'schema-utils' ;
4
4
5
5
import schema from './plugin-options.json' ;
6
- import { shared , MODULE_TYPE , compareModulesByIdentifier } from './utils' ;
6
+ import { MODULE_TYPE , compareModulesByIdentifier } from './utils' ;
7
7
8
8
const pluginName = 'mini-css-extract-plugin' ;
9
9
@@ -381,16 +381,8 @@ class MiniCssExtractPlugin {
381
381
}
382
382
}
383
383
384
- // initializeCssDependency
385
- // eslint-disable-next-line no-shadow
386
- const { CssModule, CssDependency } = shared ( webpack , ( webpack ) => {
387
- // eslint-disable-next-line no-shadow
388
- const CssModule = MiniCssExtractPlugin . getCssModule ( webpack ) ;
389
- // eslint-disable-next-line no-shadow
390
- const CssDependency = MiniCssExtractPlugin . getCssDependency ( webpack ) ;
391
-
392
- return { CssModule, CssDependency } ;
393
- } ) ;
384
+ const CssModule = MiniCssExtractPlugin . getCssModule ( webpack ) ;
385
+ const CssDependency = MiniCssExtractPlugin . getCssDependency ( webpack ) ;
394
386
395
387
compiler . hooks . thisCompilation . tap ( pluginName , ( compilation ) => {
396
388
class CssModuleFactory {
Original file line number Diff line number Diff line change @@ -3,9 +3,11 @@ import path from 'path';
3
3
import loaderUtils from 'loader-utils' ;
4
4
import { validate } from 'schema-utils' ;
5
5
6
- import { shared , findModuleById , evalModuleCode } from './utils' ;
6
+ import { findModuleById , evalModuleCode } from './utils' ;
7
7
import schema from './loader-options.json' ;
8
8
9
+ import MiniCssExtractPlugin from './index' ;
10
+
9
11
const pluginName = 'mini-css-extract-plugin' ;
10
12
11
13
function hotLoader ( content , context ) {
@@ -199,9 +201,7 @@ export function pitch(request) {
199
201
}
200
202
201
203
const count = identifierCountMap . get ( dependency . identifier ) || 0 ;
202
- const { CssDependency } = shared ( webpack , ( ) => {
203
- return { } ;
204
- } ) ;
204
+ const { CssDependency } = MiniCssExtractPlugin . getCssDependency ( webpack )
205
205
206
206
if ( ! CssDependency ) {
207
207
throw new Error (
Original file line number Diff line number Diff line change @@ -49,26 +49,7 @@ function compareModulesByIdentifier(a, b) {
49
49
return compareIds ( a . identifier ( ) , b . identifier ( ) ) ;
50
50
}
51
51
52
- const initializeCache = new WeakMap ( ) ;
53
-
54
- function shared ( webpack , initializer ) {
55
- const cacheEntry = initializeCache . get ( webpack ) ;
56
-
57
- // eslint-disable-next-line no-undefined
58
- if ( cacheEntry !== undefined ) {
59
- return cacheEntry ;
60
- }
61
-
62
- const constructors = initializer ( webpack ) ;
63
- const result = { ...constructors } ;
64
-
65
- initializeCache . set ( webpack , result ) ;
66
-
67
- return result ;
68
- }
69
-
70
52
export {
71
- shared ,
72
53
MODULE_TYPE ,
73
54
findModuleById ,
74
55
evalModuleCode ,
You can’t perform that action at this time.
0 commit comments