File tree 1 file changed +17
-3
lines changed
1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -272,8 +272,7 @@ function tryApplyUpdates(onHotUpdateSuccess) {
272
272
return ;
273
273
}
274
274
275
- // https://webpack.github.io/docs/hot-module-replacement.html#check
276
- module . hot . check ( /* autoApply */ true , function ( err , updatedModules ) {
275
+ function handleApplyUpdates ( err , updatedModules ) {
277
276
if ( err || ! updatedModules ) {
278
277
window . location . reload ( ) ;
279
278
return ;
@@ -288,5 +287,20 @@ function tryApplyUpdates(onHotUpdateSuccess) {
288
287
// While we were updating, there was a new update! Do it again.
289
288
tryApplyUpdates ( ) ;
290
289
}
291
- } ) ;
290
+ }
291
+
292
+ // https://webpack.github.io/docs/hot-module-replacement.html#check
293
+ var result = module . hot . check ( /* autoApply */ true , handleApplyUpdates ) ;
294
+
295
+ // // Webpack 2 returns a Promise instead of invoking a callback
296
+ if ( result && result . then ) {
297
+ result . then (
298
+ function ( updatedModules ) {
299
+ handleApplyUpdates ( null , updatedModules ) ;
300
+ } ,
301
+ function ( err ) {
302
+ handleApplyUpdates ( err , null ) ;
303
+ }
304
+ ) ;
305
+ }
292
306
} ;
You can’t perform that action at this time.
0 commit comments