diff --git a/packages/core/parcel-bundler/src/builtins/hmr-runtime.js b/packages/core/parcel-bundler/src/builtins/hmr-runtime.js index 526a10d20cd..ae91e67cddf 100644 --- a/packages/core/parcel-bundler/src/builtins/hmr-runtime.js +++ b/packages/core/parcel-bundler/src/builtins/hmr-runtime.js @@ -59,8 +59,8 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') { assetsToAccept.forEach(function (v) { hmrAcceptRun(v[0], v[1]); }); - } else { - window.location.reload(); + } else if (location.reload) { // `location` global exists in a web worker context but lacks `.reload()` function. + location.reload(); } }