Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import getDevServer from './getDevServer';

declare var global: {
globalEvalWithSourceUrl?: (string, string) => unknown,
__BUNDLE_LOADER_REPORTER__?: {
onStart: (url: string | URL) => void,
onSuccess: (url: string | URL) => void,
onError: (url: string | URL, error: Error) => void,
},
...
};

Expand Down Expand Up @@ -153,6 +158,7 @@ export default function loadBundleFromServer(
}
DevLoadingView.showMessage('Downloading...', 'load');
++pendingRequests;
global.__BUNDLE_LOADER_REPORTER__?.onStart(requestUrl);

loadPromise = asyncRequest(requestUrl)
.then<void>(({body, headers}) => {
Expand Down Expand Up @@ -183,9 +189,11 @@ export default function loadBundleFromServer(
// eslint-disable-next-line no-eval
eval(body);
}
global.__BUNDLE_LOADER_REPORTER__?.onSuccess(requestUrl);
})
.catch<void>(e => {
cachedPromisesByUrl.delete(requestUrl);
global.__BUNDLE_LOADER_REPORTER__?.onError(requestUrl, e);
throw e;
})
.finally(() => {
Expand Down
Loading