@@ -145,23 +145,23 @@ module.exports = class HotModuleReplacementPlugin {
145
145
146
146
const mainTemplate = compilation . mainTemplate ;
147
147
148
- mainTemplate . plugin ( "hash ", hash => {
148
+ mainTemplate . hooks . hash . tap ( "HotModuleReplacementPlugin ", hash => {
149
149
hash . update ( "HotMainTemplateDecorator" ) ;
150
150
} ) ;
151
151
152
- mainTemplate . plugin ( "module-require ", ( _ , chunk , hash , varModuleId ) => {
152
+ mainTemplate . hooks . moduleRequire . tap ( "HotModuleReplacementPlugin ", ( _ , chunk , hash , varModuleId ) => {
153
153
return `hotCreateRequire(${ varModuleId } )` ;
154
154
} ) ;
155
155
156
- mainTemplate . plugin ( "require-extensions ", source => {
156
+ mainTemplate . hooks . requireExtensions . tap ( "HotModuleReplacementPlugin ", source => {
157
157
const buf = [ source ] ;
158
158
buf . push ( "" ) ;
159
159
buf . push ( "// __webpack_hash__" ) ;
160
160
buf . push ( mainTemplate . requireFn + ".h = function() { return hotCurrentHash; };" ) ;
161
161
return Template . asString ( buf ) ;
162
162
} ) ;
163
163
164
- mainTemplate . plugin ( "bootstrap ", ( source , chunk , hash ) => {
164
+ mainTemplate . hooks . bootstrap . tap ( "HotModuleReplacementPlugin ", ( source , chunk , hash ) => {
165
165
source = mainTemplate . hooks . hotBootstrap . call ( source , chunk , hash ) ;
166
166
return Template . asString ( [
167
167
source ,
@@ -174,16 +174,16 @@ module.exports = class HotModuleReplacementPlugin {
174
174
] ) ;
175
175
} ) ;
176
176
177
- mainTemplate . plugin ( "global-hash ", ( ) => true ) ;
177
+ mainTemplate . hooks . globalHash . tap ( "HotModuleReplacementPlugin ", ( ) => true ) ;
178
178
179
- mainTemplate . plugin ( "current-hash ", ( _ , length ) => {
179
+ mainTemplate . hooks . currentHash . tap ( "HotModuleReplacementPlugin ", ( _ , length ) => {
180
180
if ( isFinite ( length ) )
181
181
return `hotCurrentHash.substr(0, ${ length } )` ;
182
182
else
183
183
return "hotCurrentHash" ;
184
184
} ) ;
185
185
186
- mainTemplate . plugin ( "module-obj ", ( source , chunk , hash , varModuleId ) => {
186
+ mainTemplate . hooks . moduleObj . tap ( "HotModuleReplacementPlugin ", ( source , chunk , hash , varModuleId ) => {
187
187
return Template . asString ( [
188
188
`${ source } ,` ,
189
189
`hot: hotCreateModule(${ varModuleId } ),` ,
0 commit comments