@@ -31,22 +31,22 @@ Top-level folders are used to organize your application's code and static assets
...
@@ -31,22 +31,22 @@ Top-level folders are used to organize your application's code and static assets
Top-level files are used to configure your application, manage dependencies, run middleware, integrate monitoring tools, and define environment variables.
Top-level files are used to configure your application, manage dependencies, run middleware, integrate monitoring tools, and define environment variables.
@@ -531,7 +531,7 @@ There are two types of sessions:
...
@@ -531,7 +531,7 @@ There are two types of sessions:
To create and manage stateless sessions, there are a few steps you need to follow:
To create and manage stateless sessions, there are a few steps you need to follow:
1. Generate a secret key, which will be used to sign your session, and store it as an [environment variable](/docs/app/building-your-application/configuring/environment-variables).
1. Generate a secret key, which will be used to sign your session, and store it as an [environment variable](/docs/app/guides/environment-variables).
2. Write logic to encrypt/decrypt session data using a session management library.
2. Write logic to encrypt/decrypt session data using a session management library.
3. Manage cookies using the Next.js [`cookies`](/docs/app/api-reference/functions/cookies) API.
3. Manage cookies using the Next.js [`cookies`](/docs/app/api-reference/functions/cookies) API.
...
@@ -547,7 +547,7 @@ There are a few ways you can generate secret key to sign your session. For examp
...
@@ -547,7 +547,7 @@ There are a few ways you can generate secret key to sign your session. For examp
opensslrand-base6432
opensslrand-base6432
```
```
This command generates a 32-character random string that you can use as your secret key and store in your [environment variables file](/docs/app/building-your-application/configuring/environment-variables):
This command generates a 32-character random string that you can use as your secret key and store in your [environment variables file](/docs/app/guides/environment-variables):
@@ -444,7 +444,7 @@ Alternatively, you can reference the public URL for the image asset based on the
...
@@ -444,7 +444,7 @@ Alternatively, you can reference the public URL for the image asset based on the
### Step 9: Migrate Environment Variables
### Step 9: Migrate Environment Variables
Next.js supports [environment variables](/docs/app/building-your-application/configuring/environment-variables) similarly to CRA but **requires** a `NEXT_PUBLIC_` prefix for any variable you want to expose in the browser.
Next.js supports [environment variables](/docs/app/guides/environment-variables) similarly to CRA but **requires** a `NEXT_PUBLIC_` prefix for any variable you want to expose in the browser.
The main difference is the prefix used to expose environment variables on the client-side. Change all environment variables with the `REACT_APP_` prefix to `NEXT_PUBLIC_`.
The main difference is the prefix used to expose environment variables on the client-side. Change all environment variables with the `REACT_APP_` prefix to `NEXT_PUBLIC_`.
...
@@ -505,7 +505,7 @@ export default nextConfig
...
@@ -505,7 +505,7 @@ export default nextConfig
### Handling a Custom `Service Worker`
### Handling a Custom `Service Worker`
If you used CRA’s service worker (e.g., `serviceWorker.js` from `create-react-app`), you can learn how to create [Progressive Web Applications (PWAs)](/docs/app/building-your-application/configuring/progressive-web-apps) with Next.js.
If you used CRA’s service worker (e.g., `serviceWorker.js` from `create-react-app`), you can learn how to create [Progressive Web Applications (PWAs)](/docs/app/guides/progressive-web-apps) with Next.js.
@@ -101,8 +101,8 @@ While building your application, we recommend using the following features to en
...
@@ -101,8 +101,8 @@ While building your application, we recommend using the following features to en
</AppOnly>
</AppOnly>
- **[Environment Variables](/docs/app/building-your-application/configuring/environment-variables):** Ensure your `.env.*` files are added to `.gitignore` and only public variables are prefixed with `NEXT_PUBLIC_`.
- **[Environment Variables](/docs/app/guides/environment-variables):** Ensure your `.env.*` files are added to `.gitignore` and only public variables are prefixed with `NEXT_PUBLIC_`.
- **[Content Security Policy](/docs/app/building-your-application/configuring/content-security-policy):** Consider adding a Content Security Policy to protect your application against various security threats such as cross-site scripting, clickjacking, and other code injection attacks.
- **[Content Security Policy](/docs/app/guides/content-security-policy):** Consider adding a Content Security Policy to protect your application against various security threats such as cross-site scripting, clickjacking, and other code injection attacks.
Ifyouarelookingtoaddlogic(oruseanexternalpackage)thatrequiresallNode.jsAPIs,youmightbeabletomovethislogictoa[layout](/docs/app/building-your-application/routing/layouts-and-templates#layouts) as a [Server Component](/docs/app/building-your-application/rendering/server-components). For example, checking [headers](/docs/app/api-reference/functions/headers) and [redirecting](/docs/app/api-reference/functions/redirect). You can also use headers, cookies, or query parameters to [redirect](/docs/app/api-reference/config/next-config-js/redirects#header-cookie-and-query-matching) or [rewrite](/docs/app/api-reference/config/next-config-js/rewrites#header-cookie-and-query-matching) through `next.config.js`. If that does not work, you can also use a [custom server](/docs/pages/building-your-application/configuring/custom-server).
Ifyouarelookingtoaddlogic(oruseanexternalpackage)thatrequiresallNode.jsAPIs,youmightbeabletomovethislogictoa[layout](/docs/app/building-your-application/routing/layouts-and-templates#layouts) as a [Server Component](/docs/app/building-your-application/rendering/server-components). For example, checking [headers](/docs/app/api-reference/functions/headers) and [redirecting](/docs/app/api-reference/functions/redirect). You can also use headers, cookies, or query parameters to [redirect](/docs/app/api-reference/config/next-config-js/redirects#header-cookie-and-query-matching) or [rewrite](/docs/app/api-reference/config/next-config-js/rewrites#header-cookie-and-query-matching) through `next.config.js`. If that does not work, you can also use a [custom server](/docs/pages/guides/custom-server).
### Environment Variables
### Environment Variables
...
@@ -142,7 +142,7 @@ You can configure the Next.js cache location if you want to persist cached pages
...
@@ -142,7 +142,7 @@ You can configure the Next.js cache location if you want to persist cached pages
-Next.jssetsthe`Cache-Control`headerof`public, max-age=31536000, immutable`totrulyimmutableassets.Itcannotbeoverridden.TheseimmutablefilescontainaSHA-hashinthefilename,sotheycanbesafelycachedindefinitely.Forexample,[StaticImageImports](/docs/app/building-your-application/optimizing/images#local-images). You can [configure the TTL](/docs/app/api-reference/components/image#caching-behavior) for images.
-Next.jssetsthe`Cache-Control`headerof`public, max-age=31536000, immutable`totrulyimmutableassets.Itcannotbeoverridden.TheseimmutablefilescontainaSHA-hashinthefilename,sotheycanbesafelycachedindefinitely.Forexample,[StaticImageImports](/docs/app/building-your-application/optimizing/images#local-images). You can [configure the TTL](/docs/app/api-reference/components/image#caching-behavior) for images.
-IncrementalStaticRegeneration(ISR)setsthe`Cache-Control`headerof`s-maxage: <revalidate in getStaticProps>, stale-while-revalidate`.Thisrevalidationtimeisdefinedinyour[`getStaticProps`function](/docs/pages/building-your-application/data-fetching/get-static-props)inseconds.Ifyouset`revalidate: false`,itwilldefaulttoaone-yearcacheduration.
-IncrementalStaticRegeneration(ISR)setsthe`Cache-Control`headerof`s-maxage: <revalidate in getStaticProps>, stale-while-revalidate`.Thisrevalidationtimeisdefinedinyour[`getStaticProps`function](/docs/pages/building-your-application/data-fetching/get-static-props)inseconds.Ifyouset`revalidate: false`,itwilldefaulttoaone-yearcacheduration.
@@ -97,7 +97,7 @@ Under the hood, `next/jest` is automatically configuring Jest for you, including
...
@@ -97,7 +97,7 @@ Under the hood, `next/jest` is automatically configuring Jest for you, including
- Ignoring `.next` from test resolving.
- Ignoring `.next` from test resolving.
- Loading `next.config.js` for flags that enable SWC transforms.
- Loading `next.config.js` for flags that enable SWC transforms.
> **Good to know**: To test environment variables directly, load them manually in a separate setup script or in your `jest.config.ts` file. For more information, please see [Test Environment Variables](/docs/app/building-your-application/configuring/environment-variables#test-environment-variables).
> **Good to know**: To test environment variables directly, load them manually in a separate setup script or in your `jest.config.ts` file. For more information, please see [Test Environment Variables](/docs/app/guides/environment-variables#test-environment-variables).
@@ -4,10 +4,10 @@ description: API reference for the mdx-components.js file.
...
@@ -4,10 +4,10 @@ description: API reference for the mdx-components.js file.
related:
related:
title: Learn more about MDX Components
title: Learn more about MDX Components
links:
links:
- app/building-your-application/configuring/mdx
- app/guides/mdx
---
---
The `mdx-components.js|tsx` file is **required** to use [`@next/mdx` with App Router](/docs/app/building-your-application/configuring/mdx) and will not work without it. Additionally, you can use it to [customize styles](/docs/app/building-your-application/configuring/mdx#using-custom-styles-and-components).
The `mdx-components.js|tsx` file is **required** to use [`@next/mdx` with App Router](/docs/app/guides/mdx) and will not work without it. Additionally, you can use it to [customize styles](/docs/app/guides/mdx#using-custom-styles-and-components).
Use the file `mdx-components.tsx` (or `.js`) in the root of your project to define MDX Components. For example, at the same level as `pages` or `app`, or inside `src` if applicable.
Use the file `mdx-components.tsx` (or `.js`) in the root of your project to define MDX Components. For example, at the same level as `pages` or `app`, or inside `src` if applicable.
@@ -7,25 +7,25 @@ description: Learn to add and access environment variables in your Next.js appli
...
@@ -7,25 +7,25 @@ description: Learn to add and access environment variables in your Next.js appli
<AppOnly>
<AppOnly>
> Since the release of [Next.js 9.4](https://nextjs.org/blog/next-9-4) we now have a more intuitive and ergonomic experience for [adding environment variables](/docs/app/building-your-application/configuring/environment-variables). Give it a try!
> Since the release of [Next.js 9.4](https://nextjs.org/blog/next-9-4) we now have a more intuitive and ergonomic experience for [adding environment variables](/docs/app/guides/environment-variables). Give it a try!
</AppOnly>
</AppOnly>
<PagesOnly>
<PagesOnly>
> Since the release of [Next.js 9.4](https://nextjs.org/blog/next-9-4) we now have a more intuitive and ergonomic experience for [adding environment variables](/docs/pages/building-your-application/configuring/environment-variables). Give it a try!
> Since the release of [Next.js 9.4](https://nextjs.org/blog/next-9-4) we now have a more intuitive and ergonomic experience for [adding environment variables](/docs/pages/guides/environment-variables). Give it a try!
</PagesOnly>
</PagesOnly>
<AppOnly>
<AppOnly>
> **Good to know**: environment variables specified in this way will **always** be included in the JavaScript bundle, prefixing the environment variable name with `NEXT_PUBLIC_` only has an effect when specifying them [through the environment or .env files](/docs/app/building-your-application/configuring/environment-variables).
> **Good to know**: environment variables specified in this way will **always** be included in the JavaScript bundle, prefixing the environment variable name with `NEXT_PUBLIC_` only has an effect when specifying them [through the environment or .env files](/docs/app/guides/environment-variables).
</AppOnly>
</AppOnly>
<PagesOnly>
<PagesOnly>
> **Good to know**: environment variables specified in this way will **always** be included in the JavaScript bundle, prefixing the environment variable name with `NEXT_PUBLIC_` only has an effect when specifying them [through the environment or .env files](/docs/pages/building-your-application/configuring/environment-variables).
> **Good to know**: environment variables specified in this way will **always** be included in the JavaScript bundle, prefixing the environment variable name with `NEXT_PUBLIC_` only has an effect when specifying them [through the environment or .env files](/docs/pages/guides/environment-variables).
**ThisheaderhasbeensupersededbyCSP's `frame-ancestors` option**, which has better support in modern browsers (see [Content Security Policy](/docs/app/building-your-application/configuring/content-security-policy) for configuration details).
**ThisheaderhasbeensupersededbyCSP's `frame-ancestors` option**, which has better support in modern browsers (see [Content Security Policy](/docs/app/guides/content-security-policy) for configuration details).
```js
```js
{
{
...
@@ -577,7 +577,7 @@ For example, a user trying to download an image, but having it treated as a diff
...
@@ -577,7 +577,7 @@ For example, a user trying to download an image, but having it treated as a diff
### Content-Security-Policy
### Content-Security-Policy
Learn more about adding a [Content Security Policy](/docs/app/building-your-application/configuring/content-security-policy) to your application.
Learn more about adding a [Content Security Policy](/docs/app/guides/content-security-policy) to your application.
@@ -273,7 +273,7 @@ If the following conditions are true:
...
@@ -273,7 +273,7 @@ If the following conditions are true:
- `react-hooks`
- `react-hooks`
- `jsx-a11y`
- `jsx-a11y`
- `import`
- `import`
- You've defined specific `parserOptions` that are different from how Babel is configured within Next.js (this is not recommended unless you have [customized your Babel configuration](/docs/pages/building-your-application/configuring/babel))
- You've defined specific `parserOptions` that are different from how Babel is configured within Next.js (this is not recommended unless you have [customized your Babel configuration](/docs/pages/guides/babel))
- You have `eslint-plugin-import` installed with Node.js and/or TypeScript [resolvers](https://github.com/benmosher/eslint-plugin-import#resolvers) defined to handle imports
- You have `eslint-plugin-import` installed with Node.js and/or TypeScript [resolvers](https://github.com/benmosher/eslint-plugin-import#resolvers) defined to handle imports
Then we recommend either removing these settings if you prefer how these properties have been configured within [`eslint-config-next`](https://github.com/vercel/next.js/blob/canary/packages/eslint-config-next/index.js) or extending directly from the Next.js ESLint plugin instead:
Then we recommend either removing these settings if you prefer how these properties have been configured within [`eslint-config-next`](https://github.com/vercel/next.js/blob/canary/packages/eslint-config-next/index.js) or extending directly from the Next.js ESLint plugin instead:
@@ -126,7 +126,7 @@ The Next.js Edge Runtime is used for Middleware and supports the following APIs:
...
@@ -126,7 +126,7 @@ The Next.js Edge Runtime is used for Middleware and supports the following APIs:
## Environment Variables
## Environment Variables
You can use `process.env` to access [Environment Variables](/docs/app/building-your-application/configuring/environment-variables) for both `next dev` and `next build`.
You can use `process.env` to access [Environment Variables](/docs/app/guides/environment-variables) for both `next dev` and `next build`.
description: With minimal config, and without leaving React, you can start adding AMP and improve the performance and speed of your pages.
description: With minimal config, and without leaving React, you can start adding AMP and improve the performance and speed of your pages.
---
---
...
@@ -16,7 +17,7 @@ You can read more about AMP in the official [amp.dev](https://amp.dev/) site.
...
@@ -16,7 +17,7 @@ You can read more about AMP in the official [amp.dev](https://amp.dev/) site.
## Enabling AMP
## Enabling AMP
To enable AMP support for a page, and to learn more about the different AMP configs, read the [API documentation for `next/amp`](/docs/pages/building-your-application/configuring/amp).
To enable AMP support for a page, and to learn more about the different AMP configs, read the [API documentation for `next/amp`](/docs/pages/guides/amp).
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. 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. */}
@@ -48,7 +48,7 @@ bun add react@latest react-dom@latest
...
@@ -48,7 +48,7 @@ bun add react@latest react-dom@latest
Next.js now uses the Rust-based compiler [SWC](https://swc.rs/) to compile JavaScript/TypeScript. This new compiler is up to 17x faster than Babel when compiling individual files and up to 5x faster Fast Refresh.
Next.js now uses the Rust-based compiler [SWC](https://swc.rs/) to compile JavaScript/TypeScript. This new compiler is up to 17x faster than Babel when compiling individual files and up to 5x faster Fast Refresh.
Next.js provides full backward compatibility with applications that have [custom Babel configuration](/docs/pages/building-your-application/configuring/babel). All transformations that Next.js handles by default like styled-jsx and tree-shaking of `getStaticProps` / `getStaticPaths` / `getServerSideProps` have been ported to Rust.
Next.js provides full backward compatibility with applications that have [custom Babel configuration](/docs/pages/guides/babel). All transformations that Next.js handles by default like styled-jsx and tree-shaking of `getStaticProps` / `getStaticPaths` / `getServerSideProps` have been ported to Rust.
When an application has a custom Babel configuration, Next.js will automatically opt-out of using SWC for compiling JavaScript/Typescript and will fall back to using Babel in the same way that it was used in Next.js 11.
When an application has a custom Babel configuration, Next.js will automatically opt-out of using SWC for compiling JavaScript/Typescript and will fall back to using Babel in the same way that it was used in Next.js 11.
>-SinceAPIRoutesrunontheserver,we're able to use sensitive values (like API keys) through [Environment Variables](/docs/pages/building-your-application/configuring/environment-variables) without exposing them to the client. This is critical for the security of your application.
>-SinceAPIRoutesrunontheserver,we're able to use sensitive values (like API keys) through [Environment Variables](/docs/pages/guides/environment-variables) without exposing them to the client. This is critical for the security of your application.
@@ -62,9 +62,9 @@ The `context` parameter is an object containing the following keys:
...
@@ -62,9 +62,9 @@ The `context` parameter is an object containing the following keys:
|`req`|[The`HTTP`IncomingMessageobject](https://nodejs.org/api/http.html#http_class_http_incomingmessage), with an additional `cookies` prop, which is an object with string keys mapping to string values of cookies. |
|`req`|[The`HTTP`IncomingMessageobject](https://nodejs.org/api/http.html#http_class_http_incomingmessage), with an additional `cookies` prop, which is an object with string keys mapping to string values of cookies. |
| `preview` | (Deprecated for `draftMode`) `preview` is `true` if the page is in the [Preview Mode](/docs/pages/building-your-application/configuring/preview-mode) and `false` otherwise. |
| `preview` | (Deprecated for `draftMode`) `preview` is `true` if the page is in the [Preview Mode](/docs/pages/guides/preview-mode) and `false` otherwise. |
| `previewData` | (Deprecated for `draftMode`) The [preview](/docs/pages/building-your-application/configuring/preview-mode) data set by `setPreviewData`. |
| `previewData` | (Deprecated for `draftMode`) The [preview](/docs/pages/guides/preview-mode) data set by `setPreviewData`. |
| `draftMode` | `draftMode` is `true` if the page is in the [Draft Mode](/docs/pages/building-your-application/configuring/draft-mode) and `false` otherwise. |
| `draftMode` | `draftMode` is `true` if the page is in the [Draft Mode](/docs/pages/guides/draft-mode) and `false` otherwise. |
| `locale` | Contains the active locale (if enabled). |
| `locale` | Contains the active locale (if enabled). |
| `locales` | Contains all supported locales (if enabled). |
| `locales` | Contains all supported locales (if enabled). |
@@ -46,7 +46,7 @@ The following is the definition of the `router` object returned by both [`useRou
...
@@ -46,7 +46,7 @@ The following is the definition of the `router` object returned by both [`useRou
- `defaultLocale`: `String` - The current default locale (if enabled).
- `defaultLocale`: `String` - The current default locale (if enabled).
- `domainLocales`: `Array<{domain, defaultLocale, locales}>` - Any configured domain locales.
- `domainLocales`: `Array<{domain, defaultLocale, locales}>` - Any configured domain locales.
- `isReady`: `boolean` - Whether the router fields are updated client-side and ready for use. Should only be used inside of `useEffect` methods and not for conditionally rendering on the server. See related docs for use case with [automatically statically optimized pages](/docs/pages/building-your-application/rendering/automatic-static-optimization)
- `isReady`: `boolean` - Whether the router fields are updated client-side and ready for use. Should only be used inside of `useEffect` methods and not for conditionally rendering on the server. See related docs for use case with [automatically statically optimized pages](/docs/pages/building-your-application/rendering/automatic-static-optimization)
- `isPreview`: `boolean` - Whether the application is currently in [preview mode](/docs/pages/building-your-application/configuring/preview-mode).
- `isPreview`: `boolean` - Whether the application is currently in [preview mode](/docs/pages/guides/preview-mode).
> Using the `asPath` field may lead to a mismatch between client and server if the page is rendered using server-side rendering or [automatic static optimization](/docs/pages/building-your-application/rendering/automatic-static-optimization). Avoid using `asPath` until the `isReady` field is `true`.
> Using the `asPath` field may lead to a mismatch between client and server if the page is rendered using server-side rendering or [automatic static optimization](/docs/pages/building-your-application/rendering/automatic-static-optimization). Avoid using `asPath` until the `isReady` field is `true`.
...
@@ -276,7 +276,7 @@ export default function Login() {
...
@@ -276,7 +276,7 @@ export default function Login() {
If`cb`returns`false`,theNext.jsrouterwillnothandle`popstate`,andyou'll be responsible for handling it in that case. See [Disabling file-system routing](/docs/pages/building-your-application/configuring/custom-server#disabling-file-system-routing).
If`cb`returns`false`,theNext.jsrouterwillnothandle`popstate`,andyou'll be responsible for handling it in that case. See [Disabling file-system routing](/docs/pages/guides/custom-server#disabling-file-system-routing).
You could use `beforePopState` to manipulate the request, or force a SSR refresh, as in the following example:
You could use `beforePopState` to manipulate the request, or force a SSR refresh, as in the following example:
@@ -5,7 +5,7 @@ description: Add client and server runtime configuration to your Next.js app.
...
@@ -5,7 +5,7 @@ description: Add client and server runtime configuration to your Next.js app.
> **Warning:**
> **Warning:**
>
>
> - **This feature is deprecated.** We recommend using [environment variables](/docs/pages/building-your-application/configuring/environment-variables) instead, which also can support reading runtime values.
> - **This feature is deprecated.** We recommend using [environment variables](/docs/pages/guides/environment-variables) instead, which also can support reading runtime values.
> - You can run code on server startup using the [`register` function](/docs/app/building-your-application/optimizing/instrumentation).
> - You can run code on server startup using the [`register` function](/docs/app/building-your-application/optimizing/instrumentation).
> - This feature does not work with [Automatic Static Optimization](/docs/pages/building-your-application/rendering/automatic-static-optimization), [Output File Tracing](/docs/pages/api-reference/config/next-config-js/output#automatically-copying-traced-files), or [React Server Components](/docs/app/building-your-application/rendering/server-components).
> - This feature does not work with [Automatic Static Optimization](/docs/pages/building-your-application/rendering/automatic-static-optimization), [Output File Tracing](/docs/pages/api-reference/config/next-config-js/output#automatically-copying-traced-files), or [React Server Components](/docs/app/building-your-application/rendering/server-components).
@@ -14,4 +14,4 @@ To address this issue, you should remove your custom Babel configuration (e.g. `
...
@@ -14,4 +14,4 @@ To address this issue, you should remove your custom Babel configuration (e.g. `
## Useful Links
## Useful Links
- [Next.js Compiler](/docs/architecture/nextjs-compiler) - Learn more about the Next.js Compiler and how it benefits your application.
- [Next.js Compiler](/docs/architecture/nextjs-compiler) - Learn more about the Next.js Compiler and how it benefits your application.
- [Customizing Babel Config](/docs/pages/building-your-application/configuring/babel) - Understand more about how to customize your Babel configuration in a Next.js application, and the implications of doing so.
- [Customizing Babel Config](/docs/pages/guides/babel) - Understand more about how to customize your Babel configuration in a Next.js application, and the implications of doing so.
@@ -5,7 +5,7 @@ description: This document explains the "Build Directory Not Writeable" error in
...
@@ -5,7 +5,7 @@ description: This document explains the "Build Directory Not Writeable" error in
## Why This Error Occurred
## Why This Error Occurred
The "Build Directory Not Writeable" error usually occurs when the file system does not permit writing to the designated directory. A common scenario for this error is when you initiate a [custom server](/docs/pages/building-your-application/configuring/custom-server) in development mode on a production server.
The "Build Directory Not Writeable" error usually occurs when the file system does not permit writing to the designated directory. A common scenario for this error is when you initiate a [custom server](/docs/pages/guides/custom-server) in development mode on a production server.
These production servers often disallow writing to the filesystem after your application is built, causing this error.
These production servers often disallow writing to the filesystem after your application is built, causing this error.
...
@@ -32,4 +32,4 @@ const app = next({ dev })
...
@@ -32,4 +32,4 @@ const app = next({ dev })
## Useful Links
## Useful Links
- [Custom Server documentation + examples](/docs/pages/building-your-application/configuring/custom-server) - Learn more about how to effectively set up and manage an ejected server in Next.js.
- [Custom Server documentation + examples](/docs/pages/guides/custom-server) - Learn more about how to effectively set up and manage an ejected server in Next.js.
@@ -17,8 +17,8 @@ invalid characters (any one of `<>&` characters). For example:
...
@@ -17,8 +17,8 @@ invalid characters (any one of `<>&` characters). For example:
We recommend using a randomly generated UUID for your nonce.
We recommend using a randomly generated UUID for your nonce.
Learn more about how to use nonces with Next.js in our [Content Security Policy](/docs/app/building-your-application/configuring/content-security-policy) docs.
Learn more about how to use nonces with Next.js in our [Content Security Policy](/docs/app/guides/content-security-policy) docs.
Next.js now uses Rust-based compiler [SWC](https://swc.rs/) to compile JavaScript/TypeScript. This new compiler is up to 17x faster than Babel when compiling individual files and up to 5x faster Fast Refresh.
Next.js now uses Rust-based compiler [SWC](https://swc.rs/) to compile JavaScript/TypeScript. This new compiler is up to 17x faster than Babel when compiling individual files and up to 5x faster Fast Refresh.
Next.js provides full backwards compatibility with applications that have [custom Babel configuration](/docs/pages/building-your-application/configuring/babel). All transformations that Next.js handles by default like styled-jsx and tree-shaking of `getStaticProps` / `getStaticPaths` / `getServerSideProps` have been ported to Rust.
Next.js provides full backwards compatibility with applications that have [custom Babel configuration](/docs/pages/guides/babel). All transformations that Next.js handles by default like styled-jsx and tree-shaking of `getStaticProps` / `getStaticPaths` / `getServerSideProps` have been ported to Rust.
When an application has custom Babel configuration Next.js will automatically opt-out of using SWC for compiling JavaScript/Typescript and will fall back to using Babel in the same way that it was used in Next.js 11.
When an application has custom Babel configuration Next.js will automatically opt-out of using SWC for compiling JavaScript/Typescript and will fall back to using Babel in the same way that it was used in Next.js 11.