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,
},
}
这有帮助吗?