Unverified Commit 0fb5fa55 authored by Shu Ding's avatar Shu Ding Committed by GitHub

Avoid disposing middleware and instrumentation hook during development (#52022)

Unlike other routes, these two entries are needed for every request so there is no reason to have them disposed. This avoids wasting extra dev server resource to get them re-compiled.
parent 80e05a88
......@@ -308,13 +308,22 @@ function disposeInactiveEntries(
) {
Object.keys(entries).forEach((entryKey) => {
const entryData = entries[entryKey]
const { lastActiveTime, status, dispose } = entryData
const { lastActiveTime, status, dispose, bundlePath } = entryData
// TODO-APP: implement disposing of CHILD_ENTRY
if (entryData.type === EntryTypes.CHILD_ENTRY) {
return
}
// For the root middleware and the instrumentation hook files,
// we don't dispose them periodically as it's needed for every request.
if (
isMiddlewareFilename(bundlePath) ||
isInstrumentationHookFilename(bundlePath)
) {
return
}
if (dispose)
// Skip pages already scheduled for disposing
return
......
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