mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? - Added separate links for the app and pages router in the shared documentation. - Added comment at the top of all shared documentation. - Fixed typos in pages documentation comment. ### Why? - To limit the switching between the different routers in shared documentation when clicking the links.
22 lines
886 B
Plaintext
22 lines
886 B
Plaintext
---
|
|
title: onDemandEntries
|
|
description: Configure how Next.js will dispose and keep in memory pages created in development.
|
|
---
|
|
|
|
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
|
|
|
|
Next.js exposes some options that give you some control over how the server will dispose or keep in memory built pages in development.
|
|
|
|
To change the defaults, open `next.config.js` and add the `onDemandEntries` config:
|
|
|
|
```js filename="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,
|
|
},
|
|
}
|
|
```
|