Commit Graph

1072 Commits

Author SHA1 Message Date
Delba de Oliveira 84cac15d1c docs: Getting Started guide on images and fonts (#73470) 2024-12-03 14:06:22 -06:00
Delba de Oliveira 14a5fd843b docs: Getting Started guide on fetching and streaming (#73352) 2024-12-03 14:05:31 -06:00
Delba de Oliveira f27ee7d7de docs: Getting Started guide on CSS (#73341) 2024-12-03 14:04:30 -06:00
Jam Balaya 4ed2815429 examples: remove app-dir in i18n-routing directory name (#73453)
### What?

1. Rename
[`app-dir-i18n-routing`](https://github.com/vercel/next.js/tree/canary/examples/app-dir-i18n-routing)
example `i18n-routing`.
2. Rename
[`i18n-routing`](https://github.com/vercel/next.js/tree/canary/examples/i18n-routing)
example `i18n-routing-pages`.
3. Update the docs mentions i18n-routing examples.
4. Update the test includes i18n-routing examples.

### Why?

The default has already been App Router anyways and a lot of examples
have migrated over.
x-ref:
https://github.com/vercel/next.js/pull/72642#issuecomment-2474415343

### How?

Change them as in
[reproduction-template](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template)
and
[reproduction-template-pages](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template-pages)
examples.

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- [x] The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- [x] Make sure the linting passes by running `pnpm build && pnpm lint`.
See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-12-03 16:56:14 +00:00
Ahsan Moin 13880d37d2 docs(typo): fix typos in file conventions, functions, and errors (#73376)
`occured` -> `occurred`
`compatability` -> `compatibility`

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-12-03 14:01:38 +00:00
Brian Blosser 5cf82f52d7 Add mention of changing debugWithEdge to debugWithChrome. (#73409)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-12-03 11:52:13 +00:00
Delba de Oliveira 90be089cd6 Getting Started docs: Images and Fonts (#73340)
Closes:
https://linear.app/vercel/issue/DOC-3697/page-images-fonts-and-assets

---------

Co-authored-by: Rich Haines <hello@richardhaines.dev>
Co-authored-by: Ismael <ismael@vercel.com>
2024-12-03 09:57:38 +00:00
JJ Kasper 1a7a180a66 Update max tag items limit in docs (#73444)
x-ref: https://github.com/vercel/next.js/pull/73124
2024-12-02 14:38:46 -08:00
Lee Robinson 953a8c9f1d docs: Fix codeblock switcher (#73436)
https://nextjs.org/docs/app/api-reference/components/link#prefetching-links-in-middleware
2024-12-02 17:58:21 +00:00
LEE HAJIN 32c9b7bdd1 Documentation Fix: Typo and URL Correction (#73397)
### What?
This pull request addresses two minor documentation issues in the
Next.js project:
1. A typo fix in the API reference for the `cacheLife` function.
2. A correction of an incorrect URL for the `experimental.typedRoutes`
in the Turbopack documentation.

### Why?
Accurate documentation is crucial for developers to effectively use the
features of Next.js. By ensuring the clarity and correctness of these
documents, we improve the user experience and aid in preventing
potential confusion when navigating and implementing the API features.

### How?
- **Typo Correction**: In
`docs/01-app/03-api-reference/04-functions/cacheLife.mdx`, the
`cacheLife` function documentation had a capitalization error in the
phrase “The `cacheLife` function.” This has been corrected to use the
correct lowercase styling: “the `cacheLife` function”.
  
- **URL Correction**: In
`docs/01-app/03-api-reference/08-turbopack.mdx`, the link pointing to
`experimental.typedRoutes` was incorrect. The link has been updated to
the correct URL:
`https://nextjs.org/docs/app/api-reference/next-config-js/typedRoutes`.

These changes ensure the accuracy and readability of the documentation,
aligning it with Next.js standards.

---

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-12-02 02:34:48 +00:00
YeonHee 9fdd9e5222 docs: add missing default to page component examples (#73233)
Hi Team.
This PR updates the Page component examples in the documentation to
include the missing default export.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-12-01 18:15:35 -08:00
Zack Tanner a35d645732 rename cssChunkPlugin experimental options (#73291)
This treats the default ("loose")/disabled as a boolean, with an
optional "strict" literal, to make the API a bit more ergonomic.
2024-11-28 00:29:41 +00:00
Zack Tanner fdaf35b96b add option to disable experimental CssChunkingPlugin (#73286)
In app router `experimental.cssChunking` is enabled by default in
"loose" mode. This is to solve issues with CSS ordering & reduce the
number of requests for CSS resources (more information can be found in
the [original PR](https://github.com/vercel/next.js/pull/63157) and the
[docs](https://nextjs.org/docs/app/api-reference/next-config-js/cssChunking)).
However, it can lead to shared CSS from unrelated pages being included
in the initially loaded CSS.

This isn't always desireable, as expressed in
https://github.com/vercel/next.js/discussions/70168. It also leads to a
drift in behavior between dev/start, as the plugin is only implemented
in start.

This provides a third option to the plugin to disable it completely for
those who are ok with the trade-offs of not having it enabled.
2024-11-27 14:31:13 -08:00
Delba de Oliveira 6e8d84bea9 Docs: Fix headings in Layouts and Pages (#73268) 2024-11-27 18:36:13 +00:00
ovogmap 7f47d08e8d convert let keyword to const keyword to data fetching and caching example (#73251)
Improving Documentation

- I noticed that using const instead of let in the example code for data
fetching and caching is more appropriate, so I made the change.

![image](https://github.com/user-attachments/assets/73eb2dd7-386f-44ee-b820-7dbdd6a803eb)

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-27 17:49:35 +00:00
YeonHee d1e554be4c docs(fetching): params to await params (#73254)
Hi Team.
This PR fixes an issue in the examples where the params object was
destructured without being awaited.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-27 17:22:50 +00:00
YeonHee a168d74f9f docs(server-actions): add missing formData type (#73257)
This PR adds the missing `FormData` type annotation to the formData
parameter in the server actions example.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-27 17:01:31 +00:00
JJ Kasper a771ce2ff2 Undeprecate revalidate APIs and rename expire APIs (#73193)
As discussed we are removing the deprecated field from `revalidateTag`
and `revalidatePath` as they aren't going away anytime soon and the new
`expire` APIs will have slightly different semantics so not a 1-1 rename
with no arguments change anymore. We are also adding the `unstable_`
prefix for `expireTag`/`expirePath` while we iterate on them so it's
clear they will change.

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2024-11-27 09:01:04 -08:00
Mohd. Nisab d4136d9966 Update authentication docs to use useActionState (#72503)
Changed example to useActionState

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


The current docs for auth using useFormState that throws error as
renamed , hence changed the example to use useActionState

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-26 15:24:03 +00:00
Delba de Oliveira e8af80de75 Docs: Update turbopack API Reference (#73215)
Closes: https://linear.app/vercel/issue/DOC-3886/[page]-turbopack

- Moves `Turbopack` page under API Reference
- Shares page between `app` and `pages` docs
- Updates page to follow template

Redirects: https://github.com/vercel/front/pull/38704
2024-11-26 15:23:28 +00:00
Delba de Oliveira faa759b0f3 Docs: forbidden and unauthorized nits (#73213)
Going through the docs with fresh eyes, picked up some nits.
2024-11-26 13:57:44 +00:00
Delba de Oliveira cebecdcab9 Getting Started Docs: Add new "Layouts and Pages" page (#73049)
Closes: https://linear.app/vercel/issue/DOC-3696/page-layouts-and-pages
2024-11-26 13:43:21 +00:00
Jiwon Choi 947f7cdd2a docs: eslint flat config (#73167)
This PR replaced eslint-related docs code examples from `.eslintrc.json`
with `eslint.config.mjs`.

Closes NDX-373
2024-11-26 13:52:50 +09:00
Hyungji 7e87edd241 docs: Improve Accuracy and Type Safety on Data Fetching Examples (#73122)
Hi, Team.

Updated Reusing data across multiple functions examples on data fetching
documentation to improve type safety and accuracy.

### Summary of Changes

1. Added Async Params


2. Fixed Dynamic Route Example Path
- Corrected the path structure for dynamic routes to reflect actual
usage as `app/page.tsx` cannot be used to access dynamic routed paths.


3. Improved Type Safety in `generateStaticParams`
- Type mismatch: `generateStaticParams` expects string parameter, but
examples used `post.id` which of type is number, causing both build time
and client run time failures.

<img width="1109" alt="image"
src="https://github.com/user-attachments/assets/ae6fad44-0b7f-4aac-ac31-74a6581c995b">

<img width="714" alt="image"
src="https://github.com/user-attachments/assets/d8fb19c9-9dd1-4e6a-8d2b-b25f719e3742">


4. Replaced let variable with const variable
- Prevent accidental reassignment as it is not needed

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-11-25 23:50:32 +00:00
Delba de Oliveira 712d7c9eab 15.1 docs: forbidden, unauthorized, and authInterrupts (#73039)
**Do not merge until https://github.com/vercel/next.js/pull/72785 lands
in canary.**

Closes:
-
https://linear.app/vercel/issue/DOC-3820/[unstable]-forbidden-and-forbiddenjs
-
https://linear.app/vercel/issue/DOC-3849/[unstable]-unauthorized-and-unauthorizedjs
-
https://linear.app/vercel/issue/DOC-3860/[experimental]-authinterrupts-config-option
2024-11-25 15:03:41 +00:00
Sam Ko 48e7ff59da docs: clarify Switching to Dynamic Rendering section (#73113)
## Why?

The default config of fetch, which is `auto no cache`, is slightly different from the fetch option `{ cache: 'no-store' }` (this opts the whole route out of statically prerendering), so we need to clarify that further.

- https://nextjs.org/docs/canary/app/api-reference/functions/fetch#optionscache
- x-ref: https://github.com/vercel/next.js/pull/72982
- Fixes https://github.com/vercel/next.js/issues/73109
2024-11-22 16:02:16 -08:00
Sam Ko 915efdd764 docs(routing): update params type to be async (v15) (#73111)
## Why?

Update params type to be async (v15).

- x-ref: https://github.com/vercel/next.js/pull/72070
2024-11-22 15:22:03 -08:00
Jam Balaya 37b815b1da docs: fix code block language on redirecting docs (#73073)
## Description
Follow up #72617.
I have already fixed at #72944.
`app/api/redirects/route.ts` is ts extension.

### Improving Documentation

- [x] Run `pnpm prettier-fix` to fix formatting issues before opening
the PR.
- [x] Read the Docs Contribution Guide to ensure your contribution
follows the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

Co-authored-by: Sam Ko <sam@vercel.com>
2024-11-22 23:04:56 +00:00
Lee Robinson 87c74c8254 docs: add details on React Compiler annotations with "use memo" (#73053)
While the React Compiler is still in beta, this functionality was not
yet documented. I also updated this to remove the 15 RC since 15 is now
stable.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-11-22 21:08:30 +00:00
lid0a b374332dd9 docs(authentication): fix typescript code example (#72533)
Co-authored-by: Sam Ko <sam@vercel.com>
2024-11-22 21:06:52 +00:00
Delba de Oliveira be82865bae Docs: Add canary tags to expirePath and expireTag (#73096)
- `expirePath` and `expireTag` are not yet available in a stable
version, so we don't want these APIs leaking into stable docs.
2024-11-22 13:00:01 -08:00
Hyungji 27961cf3f2 fix: missing await, missing type Promise (#73088)
Hi, Team.
It seems Promise is missing when defining params type.

---------

Co-authored-by: hyungji <hj@doodlin.co.kr>
Co-authored-by: Maikel <maikel.van.dort@gmail.com>
2024-11-22 15:23:00 -05:00
Emmanuel Gautier 4a203a0878 docs: fix static params as promise examples (#72553)
## Improving Documentation

dynamic `params` from `generateStaticParams` is now a promise but is now
promise in type.
Type has been changed for every Promise `params`.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-11-22 15:22:08 -05:00
Sam Ko 3ba49c7514 docs: update tags when upgrading from 13 to 14 (#73071)
## Why?

The `latest` tag currently points to v15, so we need to update the tag to `next-14`.
2024-11-21 15:55:20 -08:00
Sam Ko a40dd63cf4 docs(next-config): add experimental inline css docs (#73070)
## Why?

Add documentation for experimental `inlineCss`.

```
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  experimental: {
    inlineCss: true,
  },
}
```

- x-ref: https://github.com/vercel/next.js/pull/72195
2024-11-21 15:34:46 -08:00
Lee Robinson d434b4ce84 Revert "docs: add Fleek's Next.js template" (#73054)
Reverts vercel/next.js#72988

Right now, we're focused on making sure the examples linked are
guaranteed to work and placed inside the Next.js community GitHub
organization.
2024-11-21 11:41:25 -06:00
Hyungji 4875c5845e docs: Redirecting fix route handler path (#72617)
Hi, Team.
The path of route handler seems to be missing `api` and I'd like to fix
it.
(`middleware.ts` above the route handler file, it requests to
`/api/redirects..`)
<img width="650" alt="image"
src="https://github.com/user-attachments/assets/f9ff3034-de36-42ec-8d85-a4a923005fdf">

Thank you :) 

### Improving Documentation

- correct route handler path

---------

Co-authored-by: hyungji <hj@doodlin.co.kr>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-21 16:09:34 +00:00
kevinmitch14 4d652f71aa docs: update staleTimes.mdx (#72967)
Fix mdx formatting. 

Previously MDX was not formatted correctly. (see image - `prefetch=`)

https://nextjs.org/docs/app/api-reference/next-config-js/staleTimes

<img width="659" alt="Screenshot 2024-11-19 at 15 11 57"
src="https://github.com/user-attachments/assets/44f77fd4-657e-409a-9190-9430fd96d5f8">

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-21 16:06:29 +00:00
Sam Ko 2fcb741d7f docs(fetch): clarify default fetch behavior (#72982)
## Why?

The default fetch behavior, which is shown as `auto no cache` when you
set the config
[logging](https://nextjs.org/docs/app/api-reference/next-config-js/logging)
to `true`, essentially means fetch once on `next build` to prerender the
page. But, when a [Dynamic
API](https://nextjs.org/docs/app/building-your-application/rendering/server-components#dynamic-rendering)
is used, it will fetch from the resource on every request.

This is different from `{ cache: 'no-store' }`, which regardless of
whether Dynamic APIs are used, will de-op the page from prerendering.
2024-11-21 15:50:39 +00:00
Tobiloba Adedeji 71978f956a docs: add Fleek's Next.js template (#72988)
This pull request adds the Next.js template for Fleek. Users can use it
to get started using full-stack Next.js on Fleek.

This template is directly from the official Fleek community templates'
collection.

### What?

This adds to the templates references within the docs to get Fleek on
the Next.js documentation.

### Why?

Community templates of Next.js are great to help spread the word that
Next.js can be deployed anywhere.


<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-21 15:49:16 +00:00
Matt Mayfield 8a69b95968 🍪 Understanding Cookie Behavior in Server Components (#73001)
This is meant to add a bit more clarity of why we can't set cookies to
the browser in a server component even if it's through a server action
or route handler.

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-21 15:49:05 +00:00
Hyungji c9aa9926ca docs: incorrect params.id (#73045) 2024-11-21 14:41:20 +01:00
Hyungji 58b993c239 docs: missing await when using params (#73044) 2024-11-21 14:02:05 +01:00
Jiwon Choi 73f547a6de Display where the env was loaded from when enabled typedEnv (#70951)
### Why?

This PR added an indication of where the env was loaded from when
`experimental.typedEnv` was enabled. Also, it allows the user to set
`NODE_ENV=production` to enable the `typedEnv` feature for
`.env.production*` files.

![CleanShot 2024-11-21 at 19 48
20](https://github.com/user-attachments/assets/ce3c7180-f26a-4378-a74f-a5998a363211)

### How?

Modified `@next/env` to pass parsed envs along with the `loadedEnvFiles`
value and used the location to indicate via JSDoc.
2024-11-21 11:47:08 +00:00
Sam Ko a3960c2188 docs(sitemap): remove extra 's' (#73023)
## Why?

There's a typo in the note—Route Handler should be singular.
2024-11-20 14:32:04 -08:00
Jude Gao f803a950f6 Revert "Support custom servers with minimal node modules" (#73003)
Reverts vercel/next.js#72966
2024-11-20 15:50:41 +00:00
Michal Jez 1bf0266103 Support custom servers with minimal node modules (#72966)
## Fixing a bug

### Related issues

fixes #64031

### Why is this change needed

Per the Next.js
[docs](https://nextjs.org/docs/pages/api-reference/next-config-js/output)

> Next.js' production server is also traced for its needed files and
output at .next/next-server.js.nft.json which can be leveraged in
production.

When I tried doing this my [custom
server](https://nextjs.org/docs/pages/building-your-application/configuring/custom-server)
would crash on startup because of this codepath


https://github.com/vercel/next.js/blob/canary/packages/next/src/server/config.ts#L1022

My first attempt at fixing this involved changing

```
if (!process.env.__NEXT_PRIVATE_STANDALONE_CONFIG) {
```

to

```
if (phase === PHASE_PRODUCTION_SERVER) {
```

but this is not guaranteed to work because the next.config.js and it's
required dependencies may not be present causing the server to use the
default config

The best solution is to mimic standalone mode as closely as possible

### What does this change do

This change allows a custom server running in production with only
required files to pass in a preloaded next config (most likely from
`required-server-files.json`)

This is very similar to how the [standalone server
works](https://github.com/vercel/next.js/blob/bc49287063d6afd50a7361566b14f1ab6c26b136/packages/next/src/build/utils.ts#L2142)

### Testing

I'd like to get an initial round of feedback from the next team before I
dive into writing an integration test. I patched nextjs in my repo and
this solution worked
2024-11-19 14:12:28 -05:00
Janka Uryga bc49287063 doc: remove internal customServer flag from custom server docs (#72962) 2024-11-19 16:56:29 +00:00
Florian Boeck 8856f49f50 Docs: Changing information about data fetching cache (#72301)
What is the documentation issue?
There is incorrect information about how fetch works in the new Next.js
version (^15.0.0).
The documentation says that fetch is automatically cached in the said
version but now by default fetchs are no longer being cached

Is there any context that might help us understand?
[Link of the
section](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionscache)

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/building-your-application/caching#fetch-optionscache

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Co-authored-by: Sam Ko <sam@vercel.com>
2024-11-19 10:01:47 +00:00
Abdulrahman Alfawal 55834d982a docs: remove deprecated frameborder, adjust allowFullScreen and update the demo (#72644)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change
-->


### What?

Removed the deprecated `iframe` attribute `frameborder`, adjusted
`allowfullscreen` to be `allowFullScreen` and updated the demo video.

### Why?

- `frameborder` is marked as deprecated
([MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#frameborder),
[DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L3231-L3232))
- `allowfullscreen` should be `allowFullScreen`
([DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a5dd14a91255869c8a929284c2531bd0e96d28ff/types/react/index.d.ts#L3229))
- The YouTube `iframe` demo has an invalid embedded URL, fixed and
updated to the latest Next.js Conf as well.

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-11-19 09:54:15 +00:00