### 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>
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>
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.
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>
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>
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>
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>
## 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>
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>
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>
## 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>
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.
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>
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>
### 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.

### How?
Modified `@next/env` to pass parsed envs along with the `loadedEnvFiles`
value and used the location to indicate via JSDoc.
## 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