Next.js 暴露了某些选项让你能够进行某些控制服务器如何禁用或者在内存中保留内置页面(在开发中) …
为了改变默认行为,你可以配置next.config.js
中的onDemandEntries
配置
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,
},
}