Next.js 暴露了某些选项让你能够进行某些控制服务器如何禁用或者在内存中保留内置页面(在开发中) …

    为了改变默认行为,你可以配置next.config.js中的onDemandEntries配置

    1. module.exports = {
    2. onDemandEntries: {
    3. // period (in ms) where the server will keep pages in the buffer
    4. maxInactiveAge: 25 * 1000,
    5. // number of pages that should be kept simultaneously without being disposed
    6. pagesBufferLength: 2,
    7. },
    8. }