@@ -8,6 +8,8 @@ const { Template } = webpack;
8
8
9
9
const NS = path . dirname ( fs . realpathSync ( __filename ) ) ;
10
10
11
+ const pluginName = 'mini-css-extract-plugin' ;
12
+
11
13
class CssDependency extends webpack . Dependency {
12
14
constructor ( { identifier, content, media, sourceMap } , context , identifierIndex ) {
13
15
super ( ) ;
@@ -93,8 +95,8 @@ class MiniCssExtractPlugin {
93
95
}
94
96
95
97
apply ( compiler ) {
96
- compiler . hooks . thisCompilation . tap ( 'mini-css-extract-plugin' , ( compilation ) => {
97
- compilation . hooks . normalModuleLoader . tap ( 'mini-css-extract-plugin' , ( lc , m ) => {
98
+ compiler . hooks . thisCompilation . tap ( pluginName , ( compilation ) => {
99
+ compilation . hooks . normalModuleLoader . tap ( pluginName , ( lc , m ) => {
98
100
const loaderContext = lc ;
99
101
const module = m ;
100
102
loaderContext [ NS ] = ( content ) => {
@@ -111,7 +113,7 @@ class MiniCssExtractPlugin {
111
113
} ) ;
112
114
compilation . dependencyFactories . set ( CssDependency , new CssModuleFactory ( ) ) ;
113
115
compilation . dependencyTemplates . set ( CssDependency , new CssDependencyTemplate ( ) ) ;
114
- compilation . mainTemplate . hooks . renderManifest . tap ( 'mini-css-extract-plugin' , ( result , { chunk } ) => {
116
+ compilation . mainTemplate . hooks . renderManifest . tap ( pluginName , ( result , { chunk } ) => {
115
117
const renderedModules = Array . from ( chunk . modulesIterable ) . filter ( module => module . type === NS ) ;
116
118
if ( renderedModules . length > 0 ) {
117
119
result . push ( {
@@ -124,7 +126,7 @@ class MiniCssExtractPlugin {
124
126
} ) ;
125
127
}
126
128
} ) ;
127
- compilation . chunkTemplate . hooks . renderManifest . tap ( 'mini-css-extract-plugin' , ( result , { chunk } ) => {
129
+ compilation . chunkTemplate . hooks . renderManifest . tap ( pluginName , ( result , { chunk } ) => {
128
130
const renderedModules = Array . from ( chunk . modulesIterable ) . filter ( module => module . type === NS ) ;
129
131
if ( renderedModules . length > 0 ) {
130
132
result . push ( {
@@ -139,7 +141,7 @@ class MiniCssExtractPlugin {
139
141
} ) ;
140
142
const { mainTemplate } = compilation ;
141
143
mainTemplate . hooks . localVars . tap (
142
- 'mini-css-extract-plugin' ,
144
+ pluginName ,
143
145
( source , chunk ) => {
144
146
const chunkMap = this . getCssChunkObject ( chunk ) ;
145
147
if ( Object . keys ( chunkMap ) . length > 0 ) {
@@ -158,7 +160,7 @@ class MiniCssExtractPlugin {
158
160
} ,
159
161
) ;
160
162
mainTemplate . hooks . requireEnsure . tap (
161
- 'mini-css-extract-plugin' ,
163
+ pluginName ,
162
164
( source , chunk , hash ) => {
163
165
const chunkMap = this . getCssChunkObject ( chunk ) ;
164
166
if ( Object . keys ( chunkMap ) . length > 0 ) {
0 commit comments