File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -272,8 +272,7 @@ function tryApplyUpdates(onHotUpdateSuccess) {
272272 return ;
273273 }
274274
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 ) {
277276 if ( err || ! updatedModules ) {
278277 window . location . reload ( ) ;
279278 return ;
@@ -288,5 +287,20 @@ function tryApplyUpdates(onHotUpdateSuccess) {
288287 // While we were updating, there was a new update! Do it again.
289288 tryApplyUpdates ( ) ;
290289 }
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+ }
292306} ;
You can’t perform that action at this time.
0 commit comments