Commit graph

439 commits

Author SHA1 Message Date
Sanjaiyan Parthipan
173381a572
Fix error message about preconnect 📝 (#40360) 2023-05-07 00:05:07 +00:00
Steven
39654fd4bb
chore(docs): update next-image-unconfigured-host.md (#49175)
We have reports of users scrolling down the the bottom to copy/paste `domains` configuration, instead of using the safer `remotePatterns` configuration at the top.

This PR collapses the older `domains` configuration behind a details toggle since it is only needed for older versions of Next.js prior to 12.3.0
2023-05-03 22:10:57 +00:00
Philip Nguyen
4973420765
Fix typo in errors/version-staleness.md (#48797) 2023-04-24 20:03:44 +00:00
Wyatt Fry
16a2c64cf5
typo (#48716)
"ran" is conjugated, which cannot be used after the verb "to be", only the infinitive "run" is correct here.
2023-04-23 01:53:33 +00:00
Swarnava Sengupta
a79d1efdd0
[Docs] Update react docs link (#47891)
- This PR fixed the  Documentation link of new react.dev website.
2023-04-04 11:56:03 -07:00
Steven
3f35608fdc
fix: improve error message pages for output: export (#47765)
fix NEXT-928 ([link](https://linear.app/vercel/issue/NEXT-928))
2023-03-31 13:23:51 -07:00
Steven
af49d5098b
chore(docs): update next export to output: 'export' (#47717)
fix NEXT-927 ([link](https://linear.app/vercel/issue/NEXT-927))
2023-03-31 02:04:23 +00:00
Tom
5262594cd7
Add note about req to circular-structure error doc (#47162)
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-03-27 03:44:31 +00:00
Tim Neutkens
29d7a265df
Add warning when deopting page into client rendering entirely (#47531)
### What?

Adds a warning when `useSearchParams` deopts the entire page to
client-side rendering.

When there is no Suspense boundary the entire page becomes client-side
rendered, you can learn more about that here:
https://beta.nextjs.org/docs/api-reference/use-search-params#static-rendering

### Why?

We've seen a few cases where people accidentally deopt the entire page
by calling `useSearchParams` as there was no indicator that this deopt
happened.

### How?

When the full page deopt happens the error is caught by the rendering
code so we warn there.

Closes NEXT-589

<!-- 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 or adding/fixing 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 #

-->
2023-03-26 19:52:30 -07:00
Rich Haines
b036c0b2ec
Update react hydration error message page title (#47499)
This PR update the react hydration error pages title to better reflect the error being solved
2023-03-24 15:08:48 +00:00
Hannes Bornö
cb729c1087
Remove experimental fontLoaders option from next.config.js (#46886)
Currently there's an experimental option in `next.config.js` that lets you define default subset(s) to preload for all your fonts. [docs](https://nextjs.org/docs/basic-features/font-optimization#specifying-a-subset)

Over time we haven't seen much use of this option, and we are defining the subsets in the font function call in all our examples/docs. Imo it would be fine to drop this option.

This PR removes that experimental option. If you happen to use it you'll get a build error with [a link](f67af163cd/errors/google-fonts-missing-subsets.md).

Next step (breaking change for next major) would probably be to remove the preload and subsets properties from `next/font/google` calls, and just have something like [`preloadSubsets´](https://vercel.slack.com/archives/C8EAN8A94/p1674868993169559?thread_ts=1674707555.461809&cid=C8EAN8A94) that is required.
2023-03-13 21:34:43 +00:00
Hannes Bornö
533748d383
next/font refactoring and additional unit tests (#46731)
Currently all helper functions are exported from huge utils files. This
moves the helper functions to their own files, this approach aligns
better with the rest of the codebase.

The unit tests are split up and colocated with the function it tests.
Also added some missing tests.

Plus some overall cleanup, added comments and fixed types.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-03-06 17:16:25 -08:00
Michael Novotny
5e112c062e
Updates next/image eslint message to denote that costs may be incurred. (#46640)
Changes ESLint warning message to still encourage usage of `next/image`
for the best experience, but also denoting that optimization could come
with incurred costs.

## Feature

- [x] Documentation added
- [x] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

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

---------

Co-authored-by: Steven Tey <stevensteel97@gmail.com>
Co-authored-by: Steven <steven@ceriously.com>
2023-03-01 14:28:09 -08:00
Oskar Oldorf
d167ecce47
Documentation: Update link-no-children error page for new link (#46514)
The example still has an `<a>` inside the `<Link>` which was deprecated
with next 13.

Current page: https://nextjs.org/docs/messages/link-no-children

<!--
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:
-->


## Documentation / Examples

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

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-03-01 11:01:04 +01:00
Serkan Bektaş
0c0318e75b
Wrong function name (#46546)
The function name was written incorrectly. Property 'rewrites' does not exist on type NextResponse.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-02-28 11:46:50 +00:00
Andy
5dee445ef9
Fix broken link on node-module-in-edge-runtime.md (#46305)
I was notified that this link is broken.

Not sure if I'm missing something, but the Markdown doesn't look right, changed it to be a normal link.

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-02-23 16:01:51 +00:00
Steven
57d2963507
feat: add contentDispositionType config to Image Optimization API (#46254)
Add `contentDispositionType` config to Image Optimization API so the user can configure `inline` vs `attachment`.

This is recommended when `dangerouslyAllowSVG` is enabled but can also be used when its disabled.
2023-02-22 19:56:51 +00:00
Tim Neutkens
08bb2698f5
Update error doc for CSS Modules in third-party deps (#46121)
Fixes NEXT-355



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-02-19 13:39:13 +00:00
Hannes Bornö
bac00ba7d7
@next/font migration warning (#46036)
Print warning with migration instructions if `@next/font` is in deps.

Fixes NEXT-483

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

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

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-02-17 16:39:26 +01:00
Balázs Orbán
c16e28715f
feat: show version staleness in error overlay (#44234)Co-authored-by: Sukka <isukkaw@gmail.com> Co-authored-by: Steven <steven@ceriously.com> Co-authored-by: Hannes Bornö <hannes.borno@vercel.com> Co-authored-by: Hannes Bornö <borno.hannes@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Supersedes #37750 as the overlay has been refactored and moved into the
Next.js package itself.

If it detects an older major version, it will show "outdated". Older
minor shows "out of date". Old canary will show "out of date", with a
different message. Matching latest canary or latest will show "up to
date". It will show nothing if we could not detect the versions due to
some error.

<details>
<summary>States: Fresh, stale, outdated</summary>

Fresh:

![image](https://user-images.githubusercontent.com/18369201/208972067-8f2bd8d5-bb92-440a-a3aa-0685b18b4871.png)


Stale:

![image](https://user-images.githubusercontent.com/18369201/208971789-baec0b90-718a-4cdc-bb15-ed23ce5efcbc.png)


Outdated:

![image](https://user-images.githubusercontent.com/18369201/208972153-923ab865-e0f7-405d-9411-45ad1f545d0e.png)

</details>

Fixes NEXT-316

---------

Co-authored-by: Sukka <isukkaw@gmail.com>
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Hannes Bornö <hannes.borno@vercel.com>
Co-authored-by: Hannes Bornö <borno.hannes@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-02-17 16:18:28 +01:00
Hannes Bornö
435eca3fc5
Add next/font import (#45891)
Enables using `next/font` by adding `@next/font` as a dependency and
reexporting its loaders.

Always generates the `font-loader-manifest` as we can't know beforehand
if the user intends to use `next/font` or not.

Also adds telemetry for `next/font` usage.

The tests are updated to use `next/font`. But `@next/font` is tested in
`test/e2e/next-font/index.test.ts` and `test/e2e/app-dir/next-font` as
well to ensure it doesn't break.

Fixes NEXT-351

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-02-16 15:33:39 +01:00
Wyatt Johnson
74ca99c866
Server Router Improvements (#45716)
This adds updated matching handle for the server to separate out the matching and executing of different route types e.g. page routes, API routes, and app routes. 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-02-15 00:16:45 +00:00
Jan Kaifer
90bfb762c8
Update app-static-to-dynamic-error.md (#45704)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-02-08 16:08:35 +00:00
Dawid Czesak
e91f2b0309
Update no-img-element.md (#45701) 2023-02-08 14:11:39 +00:00
Sam Denty
d9412b7621
Update react-hydration-error.md (#43671)
This adds a new section about local overrides, as I ran into this error and it took me ages to figure out what was going wrong

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-02-07 22:38:03 +00:00
Andrés Bedoya (SrHart)
91e0be1c3e
Update no-html-link-for-pages.md (#45247)
Update no-html-link-for-pages.md based on the new link API https://nextjs.org/docs/api-reference/next/link
2023-01-25 03:17:09 +00:00
ilyasmez
57d0e77f78
chore: fix invalid-new-link error typo (#45157) 2023-01-23 17:06:50 -08:00
JJ Kasper
6b7c69fa4d
Add proper error when app path switches static to dynamic (#44989) 2023-01-18 10:24:35 -08:00
Hannes Bornö
9a5c8cebf0
Improve errors caused by Class Component rendered in a server component. (#44726)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-01-10 14:47:20 +01:00
Hannes Bornö
5f2c9d0b30
Update subset validation in @next/font/google and fix CJK bug (#44594)
Currently there's a bug when selecting Chinese, Japanese or Korean (CJK)
as subsets.
```js
const notoSans = Noto_Sans_JP({
  subsets: ['japanese'],
})
```
It actually doesn't work, nothing preloads. This PR solves this by
removing CJK languages as candidates for preloading. The reason is that
they contain so many glyphs that each font-family is split up in 100+
font files. It doesn't make sense to preload all of them.

So CJK users will have to disable preloading.
```js
const notoSansJapanese = Noto_Sans_JP({
  weight: '400',
  preload: false,
})
```
In case you do manually disable preloading like above, the default
`font-display` is changed to `swap`.

This PR also improves the validation errors of subsets.
1. Providing unknown subset
```
`@next/font` error:
Unknown subset `japanese` for font `Inter`.
Available subsets: `cyrillic`, `cyrillic-ext`, `greek`, `greek-ext`, `latin`, `latin-ext`, `vietnamese`
```
2. Missing specified subset. The error has a link with further
instructions.
```
`@next/font` error:
Missing selected subsets for font `Inter`. Please specify subsets in the function call or in your `next.config.js`. Read more: https://nextjs.org/docs/messages/google-fonts-missing-subsets
```

fixes NEXT-336

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-01-05 15:51:38 -08:00
Hannes Bornö
d89bdb2b0c
Improve errors caused by client hook called in a server component (#44538)
Improve errors caused by client hook called in a server component.

Before
![image](https://user-images.githubusercontent.com/25056922/210399932-02d1071c-0d06-4260-8f1d-7da436e8bca9.png)


After
![image](https://user-images.githubusercontent.com/25056922/210399817-f949fb14-2f81-4309-bfcb-27af38ea1329.png)

Fixes NEXT-311

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-01-04 11:01:50 +00:00
Erik Hedberg
2b3a38ee47
docs: fix spelling error (#44191)
## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-20 14:51:14 +00:00
Damien Simonin Feugas
35f1a3501a
feat: enables 'edge' as a possible runtime for API routes (#44045) 2022-12-15 10:08:03 +01:00
Steven
297459d534
Update no-img-element lint rule (#43982)
This updates the `no-img-element` lint rule to explain the trade-offs of enabling or disabling Image Optimization.
2022-12-13 01:50:59 +00:00
Hannes Bornö
50caf8b191
Add helpful error for createContext used in Server Components (#43747)
Format runtime server errors similarly to how build errors [are
formatted](https://github.com/vercel/next.js/blob/canary/packages/next/client/dev/error-overlay/format-webpack-messages.js).
Add helpful message when createContext is used in Server Components.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-12-11 20:46:29 -06:00
Michael Novotny
bd9148d498
Changes vercel/examples links from linking to GitHub repo to template marketplace (#43780)
### Description

* Gives us [Vercel] more SEO juice rather than GitHub.
* Gives us the freedom to control GitHub repo file structure independent from URLs.

## Feature

- [x] Documentation added
2022-12-07 00:27:43 +00:00
Hannes Bornö
cd8a1a4be5
Remove stack trace from full reload warning (#43453)
Adds a new error link with possible ways to fix the cause of the full reload. Removes the stack trace and adds the file causing the error to the message.

Before
![image](https://user-images.githubusercontent.com/25056922/204278894-dd773e6d-9d79-459a-abc4-243c1b22b206.png)

After:
![image](https://user-images.githubusercontent.com/25056922/204278538-5e26a174-bae4-457f-aac4-f239398227f8.png)

Fixes #43448

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-28 13:18:26 +00:00
Hannes Bornö
0f195f0270
App directory next/link dynamic href dev error (#43074)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Fixes https://github.com/vercel/next.js/issues/42715
2022-11-25 15:03:00 +01:00
Balázs Orbán
aa51c26c2e
docs: add error link when missing appDir: true (#43293)
[Slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1669206360940399)

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

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

## Documentation / Examples

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2022-11-23 12:07:14 -08:00
Lee Robinson
21d7d22454
Add JWT example to error page. (#43162)
https://github.com/vercel/feedback/issues/23531
2022-11-21 06:48:13 +00:00
JJ Kasper
8b4d9e652e
Add more details to invalid-next-config doc (#42917)
This adds some more clarity to the error doc and we can also iterate on
the warnings to show suggestions as well in follow-ups.

x-ref: [slack
thread](https://vercel.slack.com/archives/CHZGRCJSD/p1668430036939189?thread_ts=1668394104.483679&cid=CHZGRCJSD)

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-14 13:59:59 -08:00
Hannes Bornö
584d842ae0
Fix @next/font imports from outside of the root directory (#42678)
Similar to https://github.com/vercel/next.js/pull/42106. Make
`@next/font` works as expected when using `transpilePackages`.

Also makes sure `@next/font` is auto-configured correctly when in a
monorepo.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

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


Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-11-09 13:22:45 -08:00
Wyatt Johnson
fa19c4410f
next/compat/router (#42502)
After speaking with @timneutkens, this PR provides a smoother experience to users trying to migrate over to app without affecting users in pages.

 This PR adds a new export available from `next/compat/router` that exposes a `useRouter()` hook that can be used in both `app/` and `pages/`. It differs from `next/router` in that it does not throw an error when the pages router is not mounted, and instead has a return type of `NextRouter | null`. This allows developers to convert components to support running in both `app/` and `pages/` as they are transitioning over to `app/`.

A component that before looked like this:

```tsx
import { useRouter } from 'next/router';

const MyComponent = () => {
  const { isReady, query } = useRouter();
  // ...
};
```

Will error when converted over to `next/compat/router`, as `null` cannot be destructured. Instead, developers will be able to take advantage of new hooks:

```tsx
import { useEffect } from 'react';
import { useRouter } from 'next/compat/router';
import { useSearchParams } from 'next/navigation';

const MyComponent = () => {
  const router = useRouter() // may be null or a NextRouter instance
  const searchParams = useSearchParams()

  useEffect(() => {
    if (router && !router.isReady) {
      return
    }

    // In `app/`, searchParams will be ready immediately with the values, in
    // `pages/` it will be available after the router is ready.
    const search = searchParams.get('search')
    // ...
  }, [router, searchParams])

  // ...
}
```

This component will now work in both `pages/` and `app/`. When the component is no longer used in `pages/`, you can remove the references to the compat router:

```tsx
import { useSearchParams } from 'next/navigation';

const MyComponent = () => {
  const searchParams = useSearchParams()

  // As this component is only used in `app/`, the compat router can be removed.
  const search = searchParams.get('search')

  // ...
}

```

Note that as of Next.js 13, calling `useRouter` from `next/router` will throw an error when not mounted. This now includes an error page that can be used to assist developers.

We hope to introduce a codemod that can convert instances of your `useRouter` from `next/router` to `next/compat/router` in the future.

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-11-07 18:16:28 +00:00
Steven Tey
cf3bb583d9
Included negative matcher docs in upgrade guide (#42489)
<!--
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 that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-04 10:20:53 -07:00
davidnx
ee62acacfe
react-version.md: Update minimum React version for Next.js 13 (#42490)
Updated minimum React version to match information at https://nextjs.org/blog/next-13. This page is the first Google result for "next.js 13 react 17" and the info in it is out of data after Next.js 13 was released.

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-04 15:44:22 +00:00
Steven
73c5b77a84
Fix docs for next/image upgrade guide (#42424)
This fixes a typo and also clarifies when the codemod might fail to
migrate properly.
2022-11-03 11:11:06 -07:00
Shu Ding
b72dc5b69f
Improve the error message when custom export fields are used in an entry (#42221) 2022-11-01 11:17:06 -07:00
Duncan Ogle
848bb3af73
Escape HTML on "<Link> with <a> child" page (#42114)
Non-escaped characters is leading this page to attempt to render the title as HTML tags. This change escapes those values so they may present correctly

https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor

<img width="524" alt="Screenshot 2022-10-29 at 06 57 16" src="https://user-images.githubusercontent.com/5629994/198817257-47b45ce9-2841-4db1-82f2-91e2c9b22808.png">



## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-31 16:16:42 +00:00
Steven
191710ddfe
Show error message when using legacy props on new next/image (#41930)
This PR shows a better error message when using legacy props on new
`next/image` (introduced in Next.js 13) and makes the codemod more
discoverable.
2022-10-27 12:17:28 -04:00
Balázs Orbán
4d20beb7c5
BREAKING CHANGE: feat(edge): split NextCookies to RequestCookies and ResponseCookies (#41526)
Ref: [Slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1666056382299069?thread_ts=1666041444.633059&cid=C035J346QQL),
[docs update](https://github.com/vercel/front/pull/17090)

Spec: https://wicg.github.io/cookie-store/

BREAKING CHANGE:

Ref: https://github.com/vercel/edge-runtime/pull/177,
https://github.com/vercel/edge-runtime/pull/181

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-27 00:20:39 -07:00