Unverified Commit d2a2cc78 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Skip building /500 in dev mode (#39828)

Follow-up to #39826 this skips ensuring the /500 page when in development as it's not used since we use the error overlay instead. This also fixes the case where we don't clear the stalled timeout debug log when an error is thrown during ensuring.
parent 4955da9e
...@@ -1705,15 +1705,19 @@ export default abstract class Server<ServerOptions extends Options = Options> { ...@@ -1705,15 +1705,19 @@ export default abstract class Server<ServerOptions extends Options = Options> {
let using404Page = false let using404Page = false
// use static 404 page if available and is 404 response // use static 404 page if available and is 404 response
if (is404) { if (is404 && (await this.hasPage('/404'))) {
result = await this.findPageComponents('/404', query) result = await this.findPageComponents('/404', query)
using404Page = result !== null using404Page = result !== null
} }
let statusPage = `/${res.statusCode}` let statusPage = `/${res.statusCode}`
if (!result && STATIC_STATUS_PAGES.includes(statusPage)) { if (!result && STATIC_STATUS_PAGES.includes(statusPage)) {
// skip ensuring /500 in dev mode as it isn't used and the
// dev overlay is used instead
if (statusPage !== '/500' || !this.renderOpts.dev) {
result = await this.findPageComponents(statusPage, query) result = await this.findPageComponents(statusPage, query)
} }
}
if (!result) { if (!result) {
result = await this.findPageComponents('/_error', query) result = await this.findPageComponents('/_error', query)
......
...@@ -524,6 +524,7 @@ export function onDemandEntryHandler({ ...@@ -524,6 +524,7 @@ export function onDemandEntryHandler({
) )
}, stalledTime * 1000) }, stalledTime * 1000)
try {
const pagePathData = await findPagePathData( const pagePathData = await findPagePathData(
rootDir, rootDir,
pagesDir, pagesDir,
...@@ -640,7 +641,9 @@ export function onDemandEntryHandler({ ...@@ -640,7 +641,9 @@ export function onDemandEntryHandler({
invalidator.invalidate([...added.keys()]) invalidator.invalidate([...added.keys()])
await Promise.all(invalidatePromises) await Promise.all(invalidatePromises)
} }
} finally {
clearTimeout(stalledEnsureTimeout) clearTimeout(stalledEnsureTimeout)
}
}, },
onHMR(client: ws) { onHMR(client: ws) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment