Skip to content

Commit 33297b7

Browse files
committed
Fix uncaught exception warning for HMR updates in Chrome webpack#5175
1 parent 5b119e7 commit 33297b7

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

lib/HotModuleReplacement.runtime.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,19 @@ module.exports = function() {
228228
hotDeferred = null;
229229
if(!deferred) return;
230230
if(hotApplyOnUpdate) {
231-
hotApply(hotApplyOnUpdate).then(function(result) {
232-
deferred.resolve(result);
233-
}, function(err) {
234-
deferred.reject(err);
235-
});
231+
// Wrap deferred object in Promise to mark it as a well-handled Promise to
232+
// avoid triggering uncaught exception warning in Chrome.
233+
// See https://bugs.chromium.org/p/chromium/issues/detail?id=465666
234+
Promise.resolve().then(function() {
235+
return hotApply(hotApplyOnUpdate);
236+
}).then(
237+
function(result) {
238+
deferred.resolve(result);
239+
},
240+
function(err) {
241+
deferred.reject(err);
242+
}
243+
);
236244
} else {
237245
var outdatedModules = [];
238246
for(var id in hotUpdate) {

0 commit comments

Comments
 (0)