Skip to content

Commit

Permalink
feat: skip bundle stats page when load js (#12246)
Browse files Browse the repository at this point in the history
  • Loading branch information
bytemain committed Mar 28, 2024
1 parent e7e9895 commit f26517c
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions packages/preset-umi/src/features/devTool/devTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,21 @@ export default (api: IApi) => {
}
}

// bundle status
const isDone =
api.appData.bundleStatus.done &&
(enableVite ||
api.config.mfsu === false ||
api.appData.mfsuBundleStatus.done);

if (!isDone) {
res.setHeader('Content-Type', 'text/html');
res.send(loadingHtml);
return;
if (
req.headers.accept?.includes('text/html') ||
req.headers.accept === '*/*'
) {
// bundle status
const isDone =
api.appData.bundleStatus.done &&
(enableVite ||
api.config.mfsu === false ||
api.appData.mfsuBundleStatus.done);
if (!isDone) {
res.setHeader('Content-Type', 'text/html');
res.send(loadingHtml);
return;
}
}

return next();
Expand Down

0 comments on commit f26517c

Please sign in to comment.