@@ -202,7 +202,7 @@ HotModuleReplacementPlugin.prototype.apply = function(compiler) {
202202 } ) ;
203203 compiler . parser . plugin ( "call module.hot.accept" , function ( expr ) {
204204 if ( ! this . state . compilation . hotUpdateChunkTemplate ) return false ;
205- if ( expr . arguments . length > 1 ) {
205+ if ( expr . arguments . length >= 1 ) {
206206 var arg = this . evaluateExpression ( expr . arguments [ 0 ] ) ;
207207 var params = [ ] ,
208208 requests = [ ] ;
@@ -213,16 +213,21 @@ HotModuleReplacementPlugin.prototype.apply = function(compiler) {
213213 return param . isString ( ) ;
214214 } ) ;
215215 }
216- params . forEach ( function ( param , idx ) {
217- var request = param . string ;
218- var dep = new ModuleHotAcceptDependency ( request , param . range ) ;
219- dep . optional = true ;
220- dep . loc = Object . create ( expr . loc ) ;
221- dep . loc . index = idx ;
222- this . state . module . addDependency ( dep ) ;
223- requests . push ( request ) ;
224- } . bind ( this ) ) ;
225- this . applyPluginsBailResult ( "hot accept callback" , expr . arguments [ 1 ] , requests ) ;
216+ if ( params . length > 0 ) {
217+ params . forEach ( function ( param , idx ) {
218+ var request = param . string ;
219+ var dep = new ModuleHotAcceptDependency ( request , param . range ) ;
220+ dep . optional = true ;
221+ dep . loc = Object . create ( expr . loc ) ;
222+ dep . loc . index = idx ;
223+ this . state . module . addDependency ( dep ) ;
224+ requests . push ( request ) ;
225+ } . bind ( this ) ) ;
226+ if ( expr . arguments . length > 1 )
227+ this . applyPluginsBailResult ( "hot accept callback" , expr . arguments [ 1 ] , requests ) ;
228+ else
229+ this . applyPluginsBailResult ( "hot accept without callback" , expr , requests ) ;
230+ }
226231 }
227232 } ) ;
228233 compiler . parser . plugin ( "call module.hot.decline" , function ( expr ) {
0 commit comments