Skip to content

Commit 66723fc

Browse files
committed
docs: update nextjs documentation
1 parent f0c5ef4 commit 66723fc

File tree

3 files changed

+58
-2
lines changed

3 files changed

+58
-2
lines changed

apps/docs/content/en/docs/01-app/02-guides/memory-usage.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,36 @@ You can disable source map generation by adding `productionBrowserSourceMaps: fa
136136
## Edge memory issues
137137

138138
Next.js `v14.1.3` fixed a memory issue when using the Edge runtime. Please update to this version (or later) to see if it addresses your issue.
139+
140+
## Preloading Entries
141+
142+
When the Next.js server starts, it preloads each page's JavaScript modules into memory, rather than at request time.
143+
144+
This optimization allows for faster response times, in exchange for a larger initial memory footprint.
145+
146+
To disable this optimization, set the `experimental.preloadEntriesOnStart` flag to `false`.
147+
148+
```ts filename="next.config.ts" switcher
149+
import type { NextConfig } from 'next'
150+
151+
const config: NextConfig = {
152+
experimental: {
153+
preloadEntriesOnStart: false,
154+
},
155+
}
156+
157+
export default config
158+
```
159+
160+
```js filename="next.config.mjs" switcher
161+
/** @type {import('next').NextConfig} */
162+
const config = {
163+
experimental: {
164+
preloadEntriesOnStart: false,
165+
},
166+
}
167+
168+
export default config
169+
```
170+
171+
Next.js doesn't unload these JavaScript modules, meaning that even with this optimization disabled, the memory footprint of your Next.js server will eventually be the same if all pages are eventually requested.

apps/docs/content/en/docs/01-app/05-api-reference/04-functions/generate-metadata.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default function Page({ params, searchParams }) {}
102102
> - The `metadata` object and `generateMetadata` function exports are **only supported in Server Components**.
103103
> - You cannot export both the `metadata` object and `generateMetadata` function from the same route segment.
104104
> - `fetch` requests inside `generateMetadata` are automatically [memoized](/docs/app/deep-dive/caching#request-memoization) for the same data across `generateMetadata`, `generateStaticParams`, Layouts, Pages, and Server Components.
105-
> - React [`cache` can be used](/docs/app/deep-dive/caching#react-cache-function) if `fetch` is unavailable. -[ File-based metadat](/docs/app/api-reference/file-conventions/metadata) has the higher priority and will override the `metadata` object and `generateMetadata` function.
105+
> - React [`cache` can be used](/docs/app/deep-dive/caching#react-cache-function) if `fetch` is unavailable. -[ File-based metadata](/docs/app/api-reference/file-conventions/metadata) has the higher priority and will override the `metadata` object and `generateMetadata` function.
106106
107107
## Reference
108108

apps/docs/content/en/docs/01-app/05-api-reference/05-config/01-next-config-js/turbopack.mdx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The following options are available for the `turbo` configuration:
4949

5050
### Supported loaders
5151

52-
The following loaders have been tested to work with Turbopack's webpack loader implementation:
52+
The following loaders have been tested to work with Turbopack's webpack loader implementation, but many other webpack loaders should work as well even if not listed here:
5353

5454
- [`babel-loader`](https://www.npmjs.com/package/babel-loader)
5555
- [`@svgr/webpack`](https://www.npmjs.com/package/@svgr/webpack)
@@ -58,6 +58,7 @@ The following loaders have been tested to work with Turbopack's webpack loader i
5858
- [`string-replace-loader`](https://www.npmjs.com/package/string-replace-loader)
5959
- [`raw-loader`](https://www.npmjs.com/package/raw-loader)
6060
- [`sass-loader`](https://www.npmjs.com/package/sass-loader)
61+
- [`graphql-tag/loader`](https://www.npmjs.com/package/graphql-tag)
6162

6263
## Examples
6364

@@ -109,6 +110,28 @@ module.exports = {
109110
}
110111
```
111112

113+
For loaders that require configuration options, you can use an object format instead of a string:
114+
115+
```js filename="next.config.js"
116+
module.exports = {
117+
turbopack: {
118+
rules: {
119+
'*.svg': {
120+
loaders: [
121+
{
122+
loader: '@svgr/webpack',
123+
options: {
124+
icon: true,
125+
},
126+
},
127+
],
128+
as: '*.js',
129+
},
130+
},
131+
},
132+
}
133+
```
134+
112135
> **Good to know**: Prior to Next.js version 13.4.4, `turbo.rules` was named `turbo.loaders` and only accepted file extensions like `.mdx` instead of `*.mdx`.
113136
114137
### Resolving aliases

0 commit comments

Comments
 (0)