隨需載入項目 (onDemandEntries)
Next.js 公開了一些選項,讓您可以控制伺服器在開發過程中如何處置或保留已建置頁面在記憶體中。
要變更預設值,請開啟 next.config.js
並新增 onDemandEntries
設定
next.config.js
module.exports = {
onDemandEntries: {
// period (in ms) where the server will keep pages in the buffer
maxInactiveAge: 25 * 1000,
// number of pages that should be kept simultaneously without being disposed
pagesBufferLength: 2,
},
}
這有幫助嗎?