Skip to content

Commit

Permalink
Reject browser js loader promise with Error object (#7236)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkldshv committed Nov 23, 2021
1 parent 4fbc352 commit 8cabeae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/runtimes/js/src/helpers/browser/js-loader.js
Expand Up @@ -19,9 +19,12 @@ module.exports = cacheLoader(function loadJSBundle(bundle) {
script.charset = 'utf-8';
script.src = bundle;
script.onerror = function (e) {
var error = new TypeError(
`Failed to fetch dynamically imported module: ${bundle}. Error: ${e.message}`,
);
script.onerror = script.onload = null;
script.remove();
reject(e);
reject(error);
};

script.onload = function () {
Expand Down

0 comments on commit 8cabeae

Please sign in to comment.