Commit graph

1107 commits

Author SHA1 Message Date
F. Hinkelmann
3dfb66fc19
Fix missing parenthesis for link in docs (#35090)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-03-06 16:57:44 +00:00
Balázs Orbán
62c33c1eb7
feat: support pnpm with create-next-app (#34947)
* feat: support `pnpm` with `create-next-app`

* test: add `--use-pnpm` tests

* docs: mention `--use-pnpm` flag in docs

* test: remove `only`

* Update test/integration/create-next-app/index.test.ts

Co-authored-by: Steven <steven@ceriously.com>

* chore: add pnpm action setup to tests

* chore: use latest pnpm

* chore: debug

* chore: debug

* fix: fall back to `yarn` instead of `npm`

* test: run all tests

Co-authored-by: Steven <steven@ceriously.com>
2022-03-04 00:49:24 +01:00
Sigurd Spieckermann
721dc7bccd
Add missing closing parenthesis in docs (#34924)
A closing parenthesis was missing in the docs about static HTML export.
2022-03-01 16:48:08 +00:00
Alessandro
281ef22eba
Fix broken link in react-18 streaming docs. (#34884)
A link leads to a 404 page due to a missing  `/ `
2022-02-28 15:09:09 +00:00
Lee Robinson
175e081e86
Improve TypeScript documentation. (#34690)
- Moves example out of hidden dropdown at the top and features more prominently
- Adds a clone and deploy link for those looking to get started immediately
- Cross-posts ignoring TS errors docs over, because I've personally assumed it should be on this page and then ctrl+f found nothing
- Added version history to the top, based on contents of this file
- Remove custom app caveats from code snippet to improve copy-paste ability
2022-02-28 08:32:27 +00:00
JJ Kasper
0aba3072cc
Fix issues in getStaticPaths docs (#34840) 2022-02-25 20:36:05 -08:00
Andrew Hollenbach
0ec57da3a9
Update inlineCode reference (#34817)
Howdy!

MDX no longer has an `inlineCode` component in their MDXProvider ([source](https://mdxjs.com/table-of-components/)). They've migrated to a `pre` component for blocks of code and a `code` component for inline code snippets, so I've updated the example to reflect this.

I validated this locally with these example components:

```jsx
const Code = (props) => (
  <code>
    {props.children}
  </code>
);

const Pre = (props) => (
  <pre>
    {props.children}
  </pre>
);

const components = {
  pre: Pre,
  code: Code,
  ...
};
```

Applied to a test `mdx` file:

```md
This is an `inline` example.

~~~
<p>Test code</p>
~~~
```

Which generates the following html:

```html
<p>This is an <code>inline</code> example.</p>
<pre>
  <code>&lt;p&gt;Test code&lt;/p&gt;</code>
</pre>
```

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-25 18:41:05 +00:00
Aman Mittal
f32fd48ee7
Add Error Handling document (#34329)
* Add Error Handling document

* Update error-handling.md

* Add more services on client errors after Jeff's recommendation

* Update docs/advanced-features/error-handling.md

Co-authored-by: Steven <steven@ceriously.com>

* Update docs/advanced-features/error-handling.md

Co-authored-by: Steven <steven@ceriously.com>

* Update error-handling.md

* Add info about handling file not found error

* Add a screenshot of overlay when in development mode

Co-authored-by: Steven <steven@ceriously.com>
2022-02-25 11:34:00 -05:00
Colin Rice
079b507327
Add API config to allow disabling response size warning (#34700)
Adds an API config option that disables warning a user when their API response body is over 4 megs. This has been added for users who'd like to stream larger amounts of data from their API acknowledging the drawbacks. This config mirrors the existing [`externalResolver` config](https://nextjs.org/docs/api-routes/api-middlewares#custom-config).

Closes: [#33162](https://github.com/vercel/next.js/issues/33162)

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-25 02:04:02 +00:00
Hassan El Mghari
ae2d901eed
Improve rewrites documentation (#34725)
This is a PR to update the rewrites documentation. This is after struggling to get rewrites to work with `trailingSlash` for a customer as this wasn't documented. The main culprit was the `:path*` wildcard not catching trailing slashes. The changes made to for this commit were:

- [x] Added example for redirecting to blog and docs
- [x] Expanded on original code example for external URLs
- [x] Added code example for using rewrites with `trailingSlash`

### Context

For a reproduction of the `:path*` wildcard not catching trailing slashes as expected, see below. Click on the "not working" demo link below, navigate to a specific blog post, then reload the page. It will redirect infinitely.

- [Not working demo of main repo with `:path*`](https://redirect-demo-git-not-working-nutlope.vercel.app/blog/)
- [Working demo of main repo with `:path(.+)`](https://redirect-demo.vercel.app/blog/)

If you want to take a look at the code, here are the full repos. They both have `trailingSlash: true`:

- [not working main repo](https://github.com/Nutlope/redirect-demo/tree/not-working) 
- [working main repo](https://github.com/Nutlope/redirect-demo)
- [blog repo](https://github.com/Nutlope/starter-blog-example)
2022-02-24 22:25:56 +00:00
Pauldic
68e48a0809
Fix typo in documentation (#34734)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-23 18:29:12 +00:00
Kara
b3f2b38844
Remove page-specific font example from docs (#34694)
The Font Optimization docs have an outdated example that recommends
adding fonts via `next/head`. This is an anti-pattern that Next.js
has already warned about through ESLint for a while (see
https://nextjs.org/docs/messages/no-page-custom-font) and is now
starting to warn about through the console because it won't work
well with streaming architecture.

This change removes the outdated example from the docs.
Fixes #34693



## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-22 23:17:01 +00:00
khuezy
8f65c38e20
Update testing.md (#34661)
https://playwright.dev/docs/ci#running-headed
Playwright runs headless by default.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-22 03:06:03 +00:00
Thijs-Jan
dc20805433
Provide more detail to static folder placement (#34651)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


I felt the current documentation was somewhat vague on where exactly the directories would need to go, when serving the `public` and/or `static` directory with the standalone mode.
2022-02-21 20:07:54 +00:00
JJ Kasper
411a9b84d8
Add note about public folder with standalone mode (#34646) 2022-02-21 12:14:11 -06:00
Amirhossein Beigi
bf8b835e2e
fix: change showcase url (#34590)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-19 22:33:32 +00:00
Balázs Orbán
a74af1f31d
fix: mock image path as next/image expects it (#34350)
The default mock value caused `next/image` to throw an error.

Fixes #33976

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-18 04:15:57 +00:00
Maedah Batool
a52bd712fe
Update details about Cache Control Headers (#34416)
We need to update details about adding Serverless Functions' `Cache-Control` headers to `next.config.js` files. And inform developers that these headers cannot be set in `next.config.js` files.

## Bug

- [x] [Slack Thread](https://vercel.slack.com/archives/C02F56A54LU/p1644993522741169)
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2022-02-17 23:17:26 +00:00
Aman Mittal
787186a85a
Add info on rendering an error page when using getServerSideProps (#34488)
This PR adds information on rendering an error page (500 page specifically) when using `getServerSideProps`.

## Bug

- [x] Related issues linked using https://github.com/vercel/documentation/issues/106
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-17 19:04:08 +00:00
Shu Ding
ae3e55dca4
Fix 404 links in React 18 docs (#34486)
https://nextjs.org/docs/advanced-features/react-18/overview

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-17 16:52:13 +00:00
Steven
c0abf32cd8
Update docs for image optimization swr (#34483)
- Related to #27208 
- Related to #33735
2022-02-17 15:51:28 +00:00
Lee Robinson
69aedbd666
Fix typo (#34480) 2022-02-17 15:18:59 +00:00
Lee Robinson
f3c3810add
Remove hello world RSC example. (#34456)
Let's wait until we have a better place for folks to start that doesn't include my hacky code 😄 For now, we can continue to point to the demos we have previously created, which have the proper guidance and caveats. 

Replaces https://github.com/vercel/next.js/pull/34301.
2022-02-17 02:07:44 +00:00
Kitayoshi
d288d43f19
Update MDX Guide config example (#34405)
The previous example may cause an unintentional change of the current `pageExtensions` setting, especially for the people who are not familiar with <https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions>

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-16 22:06:18 +00:00
Steven
8a55612c0d
Add image config for dangerouslyAllowSVG and contentSecurityPolicy (#34431)
## Feature

- [x] Integration tests added
- [x] Documentation added
- [x] Errors have helpful link attached, see `contributing.md`



Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-02-16 19:28:22 +00:00
Jiachi Liu
ca66872389
docs: React 18, streaming SSR, RSC with new APIs. (#33986) 2022-02-15 22:35:30 -06:00
Aman Mittal
634926d8df
Add Error Handing section for ISR (#34360)
* Add Error Handing section for ISR

* Apply suggestions from code review

* update check

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-02-15 14:22:15 -06:00
Qilin Yang
74d0329bfc
Update image.md (#34374)
- Replaced outdated Vercel Image Optimization page URL



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-15 14:10:52 +00:00
David Burrows
5402f09920
Update MDX Custom Elements setup (#34175)
The current documentation for MDX Custom Element setup was not clear, ended up on https://github.com/vercel/next.js/issues/30812 before I had this configured correctly, have tried to make the config steps more explicit.




## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-14 22:27:36 +00:00
T•Ø•R•Ü•S
c0c11ad937
Few touch-ups to the docs on web forms in Next (#34286)
## Beyond the minor changes...

- Added a warning that back-end validation is more secure
- Fixed a RegEx that I'm damn-near sure is wrong.
- Returned status codes in the first back-end serverless example
- Added a link the user can click on to learn what a HTTP method is

## Changes that must be reviewed:

- Does the `script` tag need explanation? I think all that needs to be said is that you can indeed use it in Next.JS, without much trouble.



## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-14 20:21:27 +00:00
Aman Mittal
d9eba570c6
Add an example to Write server-side code directly section (#34319)
In addition to https://github.com/vercel/front/pull/12473, this PR adds an example to the section :Write server-side code directly.


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-14 19:24:31 +00:00
hjaber
8a5e1ceb86
Update missing curly brace in image.md (#34307)
* Update missing curly brace in image.md

Missing curly brace in lazyRoot component code example

* add return

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-02-14 10:37:48 -06:00
Zeno Rocha
7be6359aff
Fix typo on getInitialProps (#34309)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-14 04:19:46 +00:00
Lee Robinson
ef31084eb2
Update Middleware docs to add version history. (#34302)
Follow up from https://github.com/vercel/next.js/pull/33410.

Adds version history for Middleware so it's more clear it launched in beta, and that we have a place to track changes.
2022-02-13 22:46:30 +00:00
Hassan El Mghari
069e61d78d
Replace babel with SWC & minor changes in getting started (#34282)
## List of changes made:

- [x] Replaced babel with SWC when talking about compilers & backlinked to the Next.js 12 blog post
- [x] Changed "Setup" heading to "Automatic Setup" to make it more clear
- [x] Changed one of the cards in the "related" section to be consistent with the rest
- [x] Minor grammatical fixes

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-02-13 03:03:25 +00:00
Lee Robinson
4f5b0621c1
Alphabetize auth docs providers. (#34281)
Follow up from https://github.com/vercel/next.js/pull/33029, to prevent bias in ordering.
2022-02-13 00:51:53 +00:00
Hassan El Mghari
ca8530ffc8
Changed all occurrences of etc to match (#34280)
The [correct](https://www.grammarly.com/blog/et-cetera-etc/) way to use et cetera is to put a period right after and a comma behind it if it's being used as a list. I updated the occurrences in the docs and examples that didn't match these rules.
2022-02-13 00:22:52 +00:00
Hassan El Mghari
d5c815e52f
Update frequently asked questions in documentation (#34252)
This is a rewrite of the FAQ section as it's quite outdated. Thank you to @styfle and @leerob for the suggestions. 

**Here's a list of changes I've made:**
- Removed “How big is it”
- Removed “What syntactic features are compiled? How do I change them?”
- Replaced all occurances of "it" with "Next.js"
- Changed "Is Next.js production ready?" to mention showcase
- Started the answer to each question with either yes or no for yes/no questions
- Listed more pros for router section, changed question name, and backlined to migrating from react router docs
- Revamped "fetching data" answer to list all our data fetching methods and  backlink to docs
- Made "Can I use Next.js with my favorite JavaScript library?" more clear and emphasized the large number of examples we have
- Reorganized questions to make more sense
- Made wording more consistent throughout

**Additional Questions:**
1. Do we want to keep the "What inspired Next.js" section the same? One option could be to only keep the first sentence linking to G's article and not talk about PHP because of its reputation among newer web developers as an old & outdated  technology.
2. What's the advantage of routes always being lazy-loadable? I'd like to add this to the last bullet point of the new router question to make it obvious what the benefit is.

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-02-12 21:24:33 +00:00
Lee Robinson
a3e18daa1c
Update Preview Mode docs. (#34278)
Follow up to https://github.com/vercel/next.js/pull/34142/files.
2022-02-12 21:17:48 +00:00
JJ Kasper
2351e5b701
Update link for includeFiles glob reference (#34269)
This ensures we reference [minimatch](https://www.npmjs.com/package/minimatch) since the globs there can have different syntax. 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

Closes: https://github.com/vercel/next.js/issues/34246
2022-02-12 15:30:20 +00:00
Steven
0a916cf1d9
Update docs for image lazyRoot prop (#34241)
- Related to #32774
2022-02-11 18:37:16 +00:00
JJ Kasper
4643f3c3d7
Ensure /index route is redirected correctly (#34206) 2022-02-10 16:40:48 -06:00
Tim Neutkens
57eec8887d
Update version number in next.config.js API reference 2022-02-10 11:17:05 +01:00
Maedah Batool
b0205c1c11
Re-render details if rewrites are used (#34049)
* Add details about using rewrites

* Update docs/advanced-features/automatic-static-optimization.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>

* link to isReady

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-02-09 20:15:59 -06:00
Maia Teegarden
01ee7e0b22
Chore/stable swc compiler options (#34074)
Mark some previously experimental swc compiler options as stable under a new `compiler` option

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-10 01:54:28 +00:00
Matt Oliver
49fbbf4e34
[Docs] add note to clarify use of Link when clearing preview cookies (issue #34129) (#34142)
Add note that explains the need to pass `prefetch={false}` to `Link` component to prevent clearing cookies accidentally
(responding to issue "Docs: potential preview-mode error on production build #34129").

Note as follows:

> **Note:** If calling this route using `Link` component, you must pass in `prefetch={false}` to prevent calling `clearPreviewData` during prefetch.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ x] Make sure the linting passes by running `yarn lint`
2022-02-09 20:50:35 +00:00
Xavier Haniquaut
2e0598d02b
docs(api-routes): fix node docs links (#34125)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-09 15:02:53 +00:00
Luis Alvarez D
5235b0fe92
Add note about crawlers and fallback: true (#34114)
Added a mention that `fallback: true` behaves like `fallback: 'blocking'` back into docs. It was originally added in https://github.com/vercel/next.js/pull/29121.

## Feature

- [x] Documentation added

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2022-02-09 00:44:47 +00:00
hackerman
1efa892e97
docs: add Ory vercel example to auth page (#33029)
See also the merged https://github.com/vercel/examples/pull/40

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-08 21:59:13 +00:00
Tim Neutkens
c74e4f21ff
Add support for async fn / promise in next.config.js/.mjs (#33662)
- Add support for async function / promise export in next.config.js/.mjs
- Update docs

Adds support for https://twitter.com/timneutkens/status/1486075973204422665

But also the simpler version:

```js
module.exports = async () => {
  return {
    basePath: '/docs'
  }
}
```



## Bug

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

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-02-07 08:48:35 +00:00
Jess Telford
8eb6ddc343
[docs] Add env var load order (#32350)
My team & I keep asking the question "What order are env vars _actually_ loaded in?".

This addition surfaces the order in a clear and readable way without having to read and understand the entire "Environment Variables" documentation first.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-06 21:44:19 +00:00
Aman Mittal
80a153cd41
Update multiple docs pages to follow Docs Content style guide (#33855)
This PR addresses minor docs-related styling issues on the Getting Started, Data Fetching (Get Server Side Props), etc pages. It follows the mechanics of the Docs Content Style guide to maintain consistency across all documentation. 

Also fixes some minor issues such as missing period at the end of a sentence on docs pages like as Data Fetching (getStaticProps).

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-06 04:21:35 +00:00
fmacherey
560191ab72
Update custom server docs for async methods (#30521)
as handle() returned from app.getRequestHandler() is a Promise, it has to be handled correctly. Simply returning it, works fine.


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

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

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-06 03:22:02 +00:00
Lance Chen
93fa12921b
Fix redirect url for prefixing the default locale (#33762)
We want to prefix the default locale to the current path (`/path`), not the current href (`http://domain.tld/path`).


## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-06 02:36:50 +00:00
Eric Howey
6890e3fcf2
(docs): update i18n-routing.md (#33123)
The recommended code for `_middleware.ts` does not work in prod, but does work locally.  You need to use `request.nextUrl.pathname` to properly redirect from what I can tell.  You also need to have a quick helper function to strip off the `/default` locale at the start of the pathname as we are providing `/en` as a fallback locale.

FWIW - I am pretty new to NextJS.  Someone with more experience should probably review this suggestion before merging it.  What I can tell you however is that the code as it is in `_middleware.ts` works locally but breaks in prod.  To test this out use the code and navigate to `https//www.mysite.com` - it will work as expected on the root url, as this matches `nextUrl.href`.  Now try navigating to `https//www.mysite.com/about` and you will be redirected to `https://www.mysite.com/en/https://www.mysite.com/about`.



## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`

Closes: https://github.com/vercel/next.js/pull/33762

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-06 02:17:36 +00:00
ncphi
7309098283
Add async to middleware docs. (#31356)
* Add `async` to middleware docs. 

I was reading the docs and got nervous. It looked like middleware didn't support async/await. After digging into the examples I found out it is possible. 

Not 100% sure if this is the docs change yahs want, but I thought I'd open a PR just incase.

* Add middleware API note

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-02-05 20:01:18 -06:00
Maedah Batool
6814ca7f23
Improve Form Guide Contents (#33913)
We need to make some quick fixes to the Form guide. The PR changes title and meta description.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-05 19:08:18 +00:00
MxA
ca8dc8d011
docs: fix variable name from profileData to data in CSR page (#34018)
Since the variable name is called `data`, I believe checking `profileData` will always be `undefined`.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-05 14:57:02 +00:00
Ismael Rumzan
25d93de9fe
Updated going-to-production with loading performance (#33179)
## Documentation Update
Based on this issue: https://github.com/vercel/next.js/issues/29319

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-04 16:30:55 +00:00
Vincent Voyer
632c9860e0
docs(isr): add missing key prop in jsx loop (#33984)
Copy pasting this example with a default create-next-app leads to an eslint warning. So I thought let's fix this.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-04 14:15:56 +00:00
Jordie
834546a74f
Fix typo in new experimental Relay support docs (#33963)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-03 23:46:07 +00:00
Lee Robinson
5abd92fb56
Update custom document docs to prepare for React 18. (#33814)
To help prepare for React 18, I've found myself sharing the updated code snippet of `_document` linked in the [React 18 docs](https://nextjs.org/docs/advanced-features/react-18#react-server-components), which uses a function instead of a class.

This PR updates the Custom Document docs to help prepare for this change, by encourage readers to use the new version, and listing more tangible examples of why you would override `_document` (`lang` on `html`, className on `body`). It also reorganizes some of the caveats and warnings related to `getInitialProps` usage to only be in the single section that applies to it.

These overrides and ejections (`getInitialProps` and `renderPage`) only apply to a subset of the people looking to change document. 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-03 18:35:22 +00:00
Lee Robinson
bc223d76e0
Update deployment docs to fix oversized image. (#33934)
We made the images expand to fit the full width of the container, but the deploy button image shouldn't be that large. Also made some slight refactors here to improve on my past documentation changes.
2022-02-03 02:30:15 +00:00
Aman Mittal
ee2725f506
Update info on how to process webhooks by disabling bodyParser (#33909)
Explicitly mention disabling `bodyParser` when processing a webhook request. Uses the "webhook" keyword that becomes searchable in the docs for anyone running a search from the sidebar.

It addresses the issue [here](https://github.com/vercel/documentation/issues/71) and [this discussion](https://github.com/vercel/community/discussions/93).

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-02 16:33:35 +00:00
yuta-ike
04ca8dbff3
Update MDX document (#33916)
This PR added about `providerImportSource` option, which we need to specify in `next.config.js` to use `MDXProvider`. 


Related mdx documents: https://mdxjs.com/docs/using-mdx/#mdx-provider

> To solve this, a context can be used in React, Preact, and Vue. Context provides a way to pass data through the component tree without having to pass props down manually at every level. Set it up like so:
> 1.  Install either @mdx-js/react, @mdx-js/preact, or @mdx-js/vue, depending on what framework you’re using
> 1. Configure your MDX integration with options.providerImportSource set to that package, so either '@mdx-js/react', '@mdx-js/preact', or '@mdx-js/vue'
> 1. Import MDXProvider from that package. Use it to wrap your top-most MDX content component and pass it your components instead:

Because my English skills are not high, feel free to improve my sentences.

## Bug
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-02-02 15:27:58 +00:00
Jack Hanford
d432032bbf
Correct pluralization in newly added Relay documentation (#33880)
* Correct pluralization

* Apply suggestions from code review

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-02-01 16:03:16 -06:00
JJ Kasper
3e60c232a8
Relay Support in Rust Compiler (#33702)
Reverts vercel/next.js#33699

This re-opens the support for relay in swc, although we need to narrow in the causes for the build failures in https://github.com/vercel/next.js/runs/4950448889?check_suite_focus=true

Co-authored-by: Andrey Lunyov <102968+alunyov@users.noreply.github.com>
2022-02-01 18:18:55 +00:00
Maedah Batool
af0d082c49
Add Clarity About Downloading and Self-Hosting a Font File (#33760)
Details about downloading and self-hosting font files were missing from our[ Font Optimization docs](https://nextjs.org/docs/basic-features/font-optimization). This PR addresses these changes.

## Bug

- [x] Related issues linked using #33054

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-02-01 17:45:39 +00:00
Maedah Batool
791c356e36
Building web forms with Next.js and Vercel (#32525)
* First commit

* Test Commit

* First draft

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update intro.

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Improve docs in part 5

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Fix Form function in JSX

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update guide contents

* Add different cloud computing companies

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Add details about JavaScript validation

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Improve code for validation without JS

* Improve regex docs

* Add regular expression example

* Explain regex example

* Add regex image

* Add demo videos

* Improve small fixes

* Fix images

* Fix images

* Improve scripts

* Improve scripts

* Add links to example repo

* Test cloudinary images

* Test cloudinary images

* Add resized images

* Test videos

* Remove images folder

* test video

* Fix link

* New video component

* Add images in readme

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Add mdx frontmatter details

* Remove videos from guide

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Update docs/guides/building-forms.md

Co-authored-by: Rich Haines <hello@richardhaines.dev>

* Fix typo for Name

* Fix code changes

* Improve docs

* Improve conclusion

* Improve code syntax

* Add lint tests

* Fix yarn language test

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2022-02-01 15:11:03 +01:00
Aman Mittal
ad79c04d6b
Update Content-Security-Policy header usage explanation (#33833)
This PR improves the Content-Security-Policy header usage explanation in the `next.config.js` file.



## Bug

- [x] Related issues linked using fixes #33598 
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-01-31 20:30:47 +00:00
Delba de Oliveira
030666b5bf
[Docs] Testing docs: Comment out optional config that points to a file (#33827)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

This prevents users who copy and paste the options without creating the associated file from experiencing an error. The option is explained in the Jest Docs and in the `Optional: Extend Jest with custom matchers` section.
2022-01-31 14:49:42 +00:00
Emrin
b72eeae202
[docs] Mention SWC in TypeScript documentation. (#33801)
Update outdated TS/TSX compiler information in the documentation.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-01-30 17:30:02 +00:00
Rich Haines
138361208c
Fixed duplicate data fetching overview page + links (#33774)
This PR removes the duplicate overview link for data fetching, and fixes the corresponding links

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-01-29 02:52:40 +00:00
JJ Kasper
5ebc6d064f
Move custom server note from middleware doc (#33744)
This moves the note about custom server handling for middleware to the custom server document. 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

x-ref: https://github.com/vercel/next.js/pull/33535#discussion_r790110427
2022-01-27 22:58:01 +00:00
Nelson Frank
c2b6d235f2
Correct misspelling in testing documentation #33754 (#33755)
```diff
- Styleheets and images ....

+ Styleheets and images ....
```
closes #33754



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-27 22:12:55 +00:00
Rich Haines
8a1c947df1
Changed data fetching file name to overview to fix meta data title (#33232)
* Changed data fetching file name to overview to fix meta data title

* Update docs/api-reference/data-fetching/get-server-side-props.md

Co-authored-by: Steven <steven@ceriously.com>

* Update manifest and check

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-01-27 09:14:14 -06:00
Vienio99
a0275f2750
Update Time to First Byte (TTFB) link (#33715)
The initial link was showing 404 not found



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-26 22:49:30 +00:00
MJ
c385d1b8c4
REMOVE: duplicate key in docs/testing.md (#33681)
There is a duplicate key, `testEnvironment` in one of the examples that are located in docs/testing.md.
In my humble opinion, It is not good to have an error in examples.
My suggestion is we have only one key and it is up to developers what options they have for the `testEnvironment`.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-01-26 17:41:19 +00:00
Jeff
9b98c5a0e0
chore(docs): update security headers specification (#33673)
1. fix details on how next handles security headers

* note: check your HSTS at https://hstspreload.org
* if your using headers in the config you need to add them below like 

![Screen Shot 2022-01-25 at 9 58 30 PM](https://user-images.githubusercontent.com/8095978/151096692-1544e239-6229-4654-bf64-b01bfc13a601.png)



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2022-01-26 16:38:15 +00:00
JJ Kasper
b5d4564cca
Revert "Relay Support in Rust Compiler" (#33699) 2022-01-26 17:26:32 +01:00
Karl Horky
5c6c385100
Use relative path for example (#33565)
The paths starting with slashes in the ESLint config examples are absolute, which are almost never the correct configuration for a project. Using a relative path is a much more common configuration, and leads to much less debugging why these examples don't work.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-26 12:41:14 +00:00
Terence Bezman
b20eb99a4d
Relay Support in Rust Compiler (#33240)
## Feature

Implements feature requested in https://github.com/vercel/next.js/issues/30805. 

A few people including myself have been looking to use Relay with Next.JS and want to use the new Rust Compiler. This is my stab at an implementation. 

### How it works?
Finds all  `graphql` tagged template experssions and replaces them with `require`s to the file generated by Relay.

### Where I need help
- I've only worked with Rust a handful of times so I would appreciate any feedback on my use of language features.
- Is there any performance overhead to many duplicate usages of `require`? I imagine there's a cache in place but I want to be sure.
- I've added some unit tests & integration tests but I might be missing some use cases. Feel free to comment some use cases I'm not thinking about.

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
  - I haven't added any docs since this is an experimental API.

## Documentation / Examples

You're expected to be running the Relay Compiler along side Next.JS when you're developing. This is pretty standard. I wouldn't expect people to have any problem with this.

### Usage
In your `next.config.js`
```js
module.exports = {
  experimental: {
    relay: {
      language: 'typescript', // or 'javascript`
      artifactDirectory: 'path/to/you/artifact/directory' // you can leave this undefined if you did not specify one in the `relay.json`
    }
  }
}
```


Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-01-26 08:23:57 +00:00
Choz
d055fee266
Updated docs for getServerSideProps and getStaticProps return values (#33577)
This fixes the documentation for getServerSideProps and getStaticProps which mislead the defined type.

Current screenshot taken from [nextjs doc](https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props)

![image](https://user-images.githubusercontent.com/5223310/150689799-5da3c1b6-61ae-4455-8970-8c96f025474a.png)

However, the declared type for these types are using union type which represents **any of the following** instead of **optional**.

Declared types;
[GetStaticPropsResult](https://github.com/vercel/next.js/blob/canary/packages/next/types/index.d.ts#L107)
![image](https://user-images.githubusercontent.com/5223310/150689919-5f3cf8f8-60d3-48e4-9412-993e2ead0634.png)

[GetServerSidePropsResult](https://github.com/vercel/next.js/blob/canary/packages/next/types/index.d.ts#L160)
![image](https://user-images.githubusercontent.com/5223310/150689931-16fe3bef-eb4e-41cd-b087-98c3282d599d.png)

---

### This PR updates the documentation for their return values;

**Before**: The `...` function should return an object with the following **optional** properties:
**After**: The `...` function should return object with **any one of the following** properties:

---



## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Vadi Taslim <70912283+vaditaslim@users.noreply.github.com>
2022-01-26 02:27:55 +00:00
11koukou
7452c0bf1b
Add lazyRoot optional property to next/image component (#33290)
* Added 'rootEl' oprional property to next/Image component resembling 'root' option of the Intersection Observer API

* changed 'rootEl' to 'lazyBoundary' and its type as well

* added test, fixed initial root detection

* Update test/integration/image-component/default/test/index.test.js

Co-authored-by: Steven <steven@ceriously.com>

* prop names changed

* added 'lazyroot' prop to the documentation

* removed unused import

* Apply suggestions from code review

* Update docs with lazyRoot added in 12.0.9

Co-authored-by: Steven <steven@ceriously.com>
2022-01-25 14:54:15 +01:00
Katie Byers
eba64c29a4
Clarify headers config option description (#33484)
Reading over this page, it wasn't immediately clear to me if these were headers which would get read off of the incoming request, or headers to be added to the outgoing response.



## Documentation / Examples

- [X] Make sure the linting passes by running `yarn lint`
2022-01-25 03:12:47 +00:00
Lee Robinson
c71465d87a
Clarify next/image usage with next export based on feedback. (#33555)
[See feedback here](https://github.com/vercel/next.js/discussions/19065#discussioncomment-2021147) for how we could improve clarity on these docs.
2022-01-24 18:42:21 +00:00
Lee Robinson
a0e3e14b66
Update next/server documentation for geo (#33609)
Make it clear that `geo` is not populated by the default Next.js server, and requires your hosting platform to integrate with a geolocation service to look up the location based on the request.

If self-hosting, for example, this could be achieved with the [Google Geolocation API](https://developers.google.com/maps/documentation/geolocation/overview).
2022-01-24 17:32:40 +00:00
Luis Alvarez D
72511fce09
Removed unrequired path in docs' manifest (#33579)
Minor change to remove duplicated route in the documentation manifest, this should change the title of https://nextjs.org/docs/basic-features/data-fetching/index from

![image](https://user-images.githubusercontent.com/4278345/150690965-8f3faf8f-715c-44a5-8ccf-3d6c21f8c9ec.png)

To: `Data Fetching: Overview | Next.js`. That's because our routes reducer is matching the parent route which doesn't have a title.
2022-01-23 18:47:48 +00:00
Sævar Berg
f4c1594a6b
Update middleware documentation for custom server (#33535)
Upgrading from 12.0.0 to 12.0.8 results in `[dev] error - Error: To use middleware you must provide a `hostname` and `port` to the Next.js Server` and this requirement did not seem to be documented anywhere. Fixes #33450 which seems to have been erroneously closed.



## Bug

- [X] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-01-21 21:37:15 +00:00
Tharaka Abeyratne
d866121f04
[docs] Update authentication docs to fix iron-session link. (#33483)
Co-authored-by: Vincent Voyer <vincent@codeagain.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2022-01-21 12:21:23 +01:00
Katie Byers
7df38bc56b
fix(docs): Fix typo in Custom Build Id docs (#33515)
Tiny wordsmithing - fixing the tense of a verb and using a slightly more accurate word.
2022-01-21 04:12:53 +00:00
Hannes Bornö
c634d76162
ReferenceError in authentication.md example fixed (#33411)
Before
```jsx
export const getServerSideProps = withSession(async function ({ req, res }) {
  if (!req.session.user) {
    return {
      redirect: {
        destination: '/login',
        permanent: false,
      },
    }
  }

  return {
    props: { user }, // User not defined
  }
})
```
2022-01-17 21:07:53 +00:00
Bashu Naimi-Roy
3dc4b524e7
fix minor typo in SWR (#33378)
Fixes a small typo: "highly recommend" -> "highly recommended"
2022-01-17 04:04:42 +00:00
Martijn Hols
67bc262b69
Update security-headers.md: fix path does not match homepage (#33137)
The filter did not match the intention of the comment as `/(.*)` does not match the homepage as per https://github.com/vercel/next.js/discussions/17991#discussioncomment-1298194.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-01-15 00:36:27 +00:00
Callum Gare
5748915851
Add onLoad gottcha note to next/script docs (#33097)
Add a note to the onLoad section of the next/script documentation clarifying that onLoad will not run if `strategy="beforeInteractive"`. (That tripped me up for a bit so I thought I'd update the docs to save any one else the hassle :).)

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-01-14 16:22:57 +00:00
Tim Neutkens
ab62a13dfe
Add sections for Remove React Properties and Remove Console to compiler docs (#33311)
Adds docs for some experimental flags that were already shipped to stable.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-14 14:17:32 +00:00
Bennett Dams
5d2730bb26
docs: Mention middleware for getStaticProps (#33273)
Mention middleware to access the request for a page that uses `getStaticProps`, e.g. for authentication purposes.




## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-01-13 17:14:11 +00:00
Maedah Batool
1f685ae532
Fixed broken links in data fetching docs (#33250)
Found some broken links in the updated Data Fetching docs. Fixed all of these.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2022-01-13 16:12:55 +00:00
Gonzalo Pozzo
0c5f4e7844
Update font-optimization.md (#33266)
Copy pasting the first paragraph will trigger the `@next/next/google-font-display` lint rule, users should be able to copy and paste it without warnings.
2022-01-13 15:31:08 +00:00
Hammed A. Olajide
cc345b74ca
Typo Fix (#33252) 2022-01-13 13:39:53 +01:00
Aziz Abbas
de54ad895c
[examples] Add a statically generated blog example using Next.js and Builder.io (#22094)
A statically generated blog example using Next.js and [Builder.io](https://builder.io), demo on [https://cms-builder-io.vercel.app/](https://cms-builder-blog.vercel.app/)
2022-01-12 21:58:43 +00:00
Alexander Kachkaev
6c8808e90e
Remove outdated & possibly confusing statement about redirects (#33224)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

The statement I have removed may be misleading. A colleague of mine has interpreted it as ‘we need to create a custom page or `<Link href="/redirect-path" />` won’t work on the client’. I just ran `npx create-next-app --example redirects redirects-app` and confirmed that this was not necessary.

So saying that redirects “do not affect client-side routing” is probably wrong. They do and they do it the right way.
2022-01-12 17:32:23 +00:00
Rich Haines
22eca10c6a
Added links to data fetching api refs, fixed title (#33221)
This PR adds links from the data fetching api pages to their api ref pages. Also removes rouge backticks on header

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-12 15:52:55 +00:00
Rich Haines
b3226303be
Removed backticks on data fetching api titles (#33216)
This PR removes the backticks used when referring to a data fetching api in a title `getStaticProps` => getStaticProps

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-12 14:21:22 +00:00
Rich Haines
029f2e360f
Fixed broken link (#33209) 2022-01-12 13:35:17 +01:00
Rich Haines
d291aa9134
Refactor data fetching API docs (#30615)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-01-12 08:56:51 +01:00
Hiroaki Ogasawara
b6b7d85f6d
Docs: correct ignorance pattern for .env.local (#32647)
* Docs: correct ignorance pattern for env.local

In order to gitignore `.env.local`, I need to add `.env*.local` instead of `.env.*.local` to `.gitignore`.

* Update docs/basic-features/environment-variables.md

Co-authored-by: Steven <steven@ceriously.com>

* Update docs/basic-features/environment-variables.md

Co-authored-by: Balázs Orbán <info@balazsorban.com>

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-01-12 02:56:07 +01:00
Manny Becerra
36eba95227
Fixes #33153: Updating cross-references from master to main + canary (#33198)
* copy cleanup in env. variables docs

* copy cleanup in fast refresh docs

* Supplements #33153 - updating existing cross-references to `master` branch to renamed default branch of `main`

* Supplements #33153 - updating existing cross-references to `master` branch to renamed default branch of `main`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-01-12 02:55:35 +01:00
Glenn Gijsberts
5f4947e5a2
Add Caveats section to custom error page (#33160)
## Desscription

This is a follow up of https://github.com/vercel/next.js/pull/32873. As discussed in #32873, currently it's not recommended to use getServerSideProps in the `Error` component, so this PR will add that caveat to the documentation page, like `Document` and `App` also have.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-01-10 21:52:08 +00:00
Alexandru Tenie
8ae08b94d8
No info on environment variables in the src folder (#33110) (#33136)
Proposes fix to #33110

Adds info on environment variables and the /src folder in the following docs:

- https://nextjs.org/docs/advanced-features/src-directory
- https://nextjs.org/docs/basic-features/environment-variables#loading-environment-variables

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2022-01-10 13:58:29 +00:00
Manny Becerra
213f5a43ea
docs: minor text-copy cleanup (#33120)
Proposes some minor text-copy cleanup in the following docs:

- https://nextjs.org/docs/basic-features/fast-refresh
- https://nextjs.org/docs/basic-features/environment-variables

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-01-10 10:52:47 +00:00
Balázs Orbán
e5e04c9039
Update using-mdx.md (#33077) 2022-01-07 00:32:31 +01:00
Lee Robinson
52d5adf8ab
Fix link for Next.js Analytics in docs (#33049)
The relative path was not working.
2022-01-06 01:30:34 +00:00
Lee Robinson
26ddf32f53
Update deployment documentation. (#32006)
Building off https://github.com/vercel/next.js/pull/31465 for `next export` docs.

- Clearly explains the standard output from `next build`
- Move Dockerfile snippet to example, instead of embedded directly
- Clarify both Vercel and `next start` use the Build API output spec
- Less emphasis on recommending Vercel (more neutrality)
- Mention Middleware & Edge Functions when discussing Vercel
- Add "Going to Production" link at the bottom for related reading
2022-01-05 21:56:05 +00:00
Balázs Orbán
3ad2035ae6
feat(cli): introduce next info CLI command (#32972)
This PR adds a new command to the `next` CLI.

Running `next info` will print useful information to the terminal about how/where Next.js is run. This information can be added to the Bug report when opening an issue in the repository.

This makes reporting issues more accurate and doesn't require the user to guess certain details, the command will retrieve it on their behalf.

Example output:

```sh
$ npx --no-install next info

    Operating System:
      Platform: linux
      Version: #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021
    Binaries:
      Node: 16.13.0
      npm: 8.1.0
      Yarn: 1.22.17
      pnpm: 6.24.2
    Relevant packages:
      next: 12.0.8-canary.14
      react: 17.0.2
      react-dom: 17.0.2


```

The idea is based on #32858

## Bug

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

## Feature

- [x] 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2022-01-04 15:35:32 +00:00
Mike K
7c8500f16d
Updated wrong link to example of gtag init in measuring-performance.md (#32974)
Updated wrong link to example of gtag init



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ x ] Make sure the linting passes by running `yarn lint`
2022-01-04 01:57:59 +00:00
Doug
92c5aa8001
Update scrolling example using query param instead of hash (#31473)
The example cited doesn't make sense, unless I'm truly missing something. The example is talking about hashes... i.e. #about. Not a query param, like ?=count=10. So in the example, the scroll={false} doesn't make any sense, since the href is not using a hash/anchor tag. I could be wrong, so be gentle.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-01-01 18:11:09 +00:00
minervabot
a17807246f
Update lint-staged example to use node.js path (#30510)
The current example attempts to remove resolve the relative pathname of the absolute pathnames given by `lint-staged` using string manipulation and `process.cwd()`. This is a risky solution because pathnames have many platform dependent edge cases. The example also returns pathnames that are technically wrong in linux. `/home/project/file => /file`,

I propose to use the utilities provided by node.js to resolve the relative pathnames, and to format the sample `.lintstagedrc.js` file in a manner easier for novice programmers to understand and modify.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-01-01 17:35:28 +00:00
Houssein Djirdeh
d72f5bd69d
[ESLint] Adds lint rule to flag usage of <head> (#32897)
## Bug

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

Fixes #30142
2021-12-31 05:09:44 +00:00
Jiachi Liu
636d3aeda7
doc: add quotes to api (#32898)
x-ref: #32896
2021-12-29 18:15:23 +00:00
Shu Ding
ec2e107f7f
Update the React 18 documentation (#32896)
Currently you don't need to enable `concurrentFeatures` to start using React 18, this PR makes the docs more clear on that.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-29 17:25:55 +00:00
JJ Kasper
723caedaac
Update note about .next/static in standalone mode (#32771) 2021-12-23 12:24:38 -06:00
Balázs Orbán
48dba6457d
chore: convert Jest examples to TypeScript (#32705)
* chore: convert Jest examples to TypeScript

* test: use absolute imports in test files

* chore: address review comments

* fix: add pages to tsconfig.json paths

* fix: add styles to tsconfig.json paths

* chore: upgrade dependencies/snapshots

* docs: match Testing docs with example code

* docs: link to docs from mock test files

Co-authored-by: Lee Robinson <me@leerob.io>
2021-12-22 01:12:07 +01:00
Kiko Beats
0eba5b2558
web runtime: add AbortController & AbortSignal (#32089)
It adds AbortController and AbortSignal Web runtimes APIs to be used by the user at Edge Functions.

For doing that it delegates into `abort-controller` dependency that has been frozen to prevent any modification.

Co-authored-by: Zhang Zhi <20026577+fytriht@users.noreply.github.com>
2021-12-21 17:12:53 +00:00
Rich Haines
4f67edd638
Added example for setting cookie before redirect in middleware (#32542) 2021-12-21 15:12:02 +01:00
Rich Haines
f176683806
Added section about router methods returning a promise (#31341)
This PR adds a section on certain router methods returning a promise, and the error you will see if you have no-floating-promises enabled.

## Bug

- [x] Related issues linked using fixes: https://github.com/vercel/next.js/issues/31337
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-19 23:07:11 +00:00
Dan Page
2be207a288
Add moduleDirectories for TS Jest Config (#32574)
It took me a while to work out that if using TypeScript with the `baseUrl` set to `.` (quite common) - then the tests fail as Jest can't find the modules.

Explicitly setting the `moduleDirectories`, as per the change to the config, fixes this issue.



## Documentation / Examples

- [x] Fixup commit
- [x] Make sure the linting passes by running `yarn lint`
2021-12-17 21:30:26 +00:00
Hike Baghdasaryan
f26fea92af
Fix typo in documentation (#32581)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-16 18:39:14 +00:00
JJ Kasper
15ff1a37d9
Document basePath redirect field for getStaticProps/getServerSideProps (#32550) 2021-12-16 09:54:40 +01:00
Madison Dickson
0794cc07c0
Include mention of the onError Prop for next/script (#31945)
* Include mention of the onError Prop

None of the documentation includes this, despite being written into the code.
Would be good to mention the function signature change somewhere between v11 and v12 that now includes the error object. (Was confused when my TS definitions were complaining about my onError handler, reading the repo's code while using the v11.1.x version in my project)

* Update docs/basic-features/script.md

Co-authored-by: Steven <steven@ceriously.com>

* Update docs/basic-features/script.md

Co-authored-by: Steven <steven@ceriously.com>

* lint-fix

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-12-15 22:38:01 -06:00
Ismail Ghallou
797e260e1e
doc: update remark import (#32481)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-14 11:01:44 +00:00
Jiachi Liu
0ad4ad6dcd
Update react version to rc in react-18 doc (#32473)
* Update react version to rc in react-18 doc

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2021-12-14 00:09:33 +01:00
xiaohai
d66579409e
docs: remove empty example link (#32439)
https://github.com/vercel/next.js/tree/canary/examples/custom-server 
This example has been moved to the documentation


## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-12-13 15:19:39 +00:00
Stephen Gheysens
adbe237d0c
Updated link to Local Images (#32427)
Local Images is on the Image Optimization page under the Basic Features docs



## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2021-12-12 20:12:26 +00:00
JJ Kasper
8d241ac4a7
Document staticPageGenerationTimeout config (#32306)
* Document staticPageGenerationTimeout config

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* Reword no activity

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

* fix lint-language

Co-authored-by: Steven <steven@ceriously.com>
2021-12-08 17:05:05 -06:00
JJ Kasper
1a6a1e5fdf
Add docs for leveraging outputStandalone config (#32255)
This adds documentation to explain how the `outputStandalone` config can be leveraged to reduce production deployment size and leverage the output file traces.  This also adds a note for the `outputFileTracingRoot` config as it may be needed in some monorepo setups. 

A follow-up PR will update our Docker example to leverage this config as well. 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

x-ref: https://github.com/vercel/next.js/pull/31003
x-ref: https://github.com/vercel/next.js/issues/32252
Closes: https://github.com/vercel/next.js/issues/30822
2021-12-07 23:22:21 +00:00
Rasmus John Pedersen
ecf9f8775c
Add Umbraco Heartcore blog example (#21409)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-12-07 16:38:55 +01:00
Maedah Batool
05bb5104d4
Details about starting dev server Next.js docs. (#32002)
The details about starting a development server and viewing your changes locally are wrongly placed in the Getting Started section in the Next.js Docs. Currently, it resides under the "Manual Setup" section. Ideally, it should be under the "Setup" section.

## Feature

- [x] Related issues linked using #31998
- [x] Documentation added

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-06 22:37:02 +00:00
Chimit
cffd209a67
Removed misleading id's from headings (#32163)
`id`'s are not generated automatically without plugins like `rehype-slug`.

https://github.com/vercel/next.js/issues/32158



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-12-06 17:04:26 +00:00
Arthur Fiorette
20814c34f5
Fixed Yarn and NPM dev swapped arguments (#32135)
## 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-12-05 00:47:56 +00:00
Leonardo Ortiz
31d2184972
docs(Testing): Remove duplicate link (#32071)
There was two items `Use a development server`, both linking to the same URL. The last one was removed.
2021-12-03 01:07:31 +00:00
Leonard Martin
5747435d87
Add note to docs about sharp memory usage on default Linux setup (#31919)
It's fairly opaque to the user that there are problems with `sharp` in an out-of-the-box Linux environment, and so if `sharp` is going to be explicitly recommended for non-Vercel production environments then I think it's a good idea to make sure people are aware of the possible issues.

My vanilla Heroku deployment was using wild amounts of memory until I found the details in the sharp docs about how to configure the memory allocator, so signposting this a bit better should help prevent issues in future.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2021-12-01 20:53:04 +00:00
Vincent Voyer
2bd296d4ef
docs(NextRequest): req.cookie => req.cookies (#31975) 2021-11-30 15:34:17 -06:00
Delba de Oliveira
306c467c3b
Update Jest examples and docs (#31633)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: stefanprobst <stefan.probst@univie.ac.at>
Co-authored-by: Rich Haines <hello@richardhaines.dev>
2021-11-30 15:10:40 -06:00
Steven
b01a6ba665
Add TS types for NextMiddleware (#30578)
This allows TypeScript users to have type safety for middleware functions.

- Closes #30490 

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-30 20:43:40 +00:00
Jiachi Liu
85e578a906
Enable default functional document when concurrentFeatures is enabled (#31954)
## Bug

Fixes: #31675 

Functional document without gIP should be enabled when streaming is enabled, even without rsc

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2021-11-30 12:52:14 +00:00
Lee Robinson
6e6bd2158f
Update next export documentation. (#31465) 2021-11-29 20:50:41 -06:00
Maedah Batool
2781b8eb87
Improve Middleware Set Cookie API documentation (#31707) 2021-11-29 16:44:58 -06:00
Leonardo Ortiz
0202bb0a99
Docs(React 18): remove unnecessary React import (#31900)
In the `Server Components APIs (Alpha)` code sample, importing `React` is unnecessary. People may think that having `react`'s default export imported is needed to use `Suspense`
2021-11-29 01:21:06 +00:00
Leonardo Ortiz
efd5d03a8c
Docs(React 18): add missing Suspense import (#31897)
This PR adds a missing import in React 18 documentation's sample code, where `Suspense` is used without being imported.

_(edit: fix typo)_
2021-11-29 00:46:26 +00:00
Austin P
c10a841620
docs(middleware): file extension consistency (#31879)
Almost every one of the examples for middleware specific a `.ts` file extension, this PR just makes it consistent.
2021-11-28 15:56:31 +00:00
Samuli Asmala
ed1d0241db
Docs(router): Add type for url parameter (#31737)
Update documentation to have proper type for the url parameter of router.push method. Also add link to Node.JS documentation for full explanation of the UrlObject properties.
2021-11-26 13:37:46 +00:00
Abir
d72e429a73
[Docs][Fix] Broken Link to API Reference (#31820)
## Documentation / Examples
- [x] Make sure the linting passes by running `yarn lint`

## Steps to Reproduce

1. Go to https://nextjs.org/docs/advanced-features/debugging#debugging-with-vs-code

2. Click on the link as shown in red underlined in below image.
<img width="835" alt="image" src="https://user-images.githubusercontent.com/53480076/143548215-ee75deac-3e8b-42b3-ba72-fae0b76b30a3.png">

3. Ending up with the **404 Error** screen
<img width="835" alt="image" src="https://user-images.githubusercontent.com/53480076/143548364-7ddf45c9-4e69-44eb-9217-3547419e103a.png">

## Fixing Steps

Replace the broken link with correct one.
2021-11-26 09:13:01 +00:00
Gergely Gazda
b71f9d9475
docs(next-config): extend phase lines reference (#31711)
Next config `phase` attribute's default value list has been extended. This PR extends the number of referenced lines in the documentation.

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-25 10:37:18 +00:00
Rich Haines
a371447555
Added note on env vars (#31237)
This PR adds a note on how to access env vars in middleware

## Bug

- [x] Related issues linked using fixes: #30612
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
2021-11-23 20:55:17 +00:00
Ben Schwarz
98227b273f
Fix typo in MDX guide (#31709)
In this PR:

- [x] Fixes a 1 character typo in the newly merged MDX guide
2021-11-22 23:35:25 +00:00
Rich Haines
91e8620376
Added guide for setting up Next.js with MDX (#30869)
This PR adds a new section on using MDX. It includes a guide for setting up Next.js with `@next/mdx`


## Bug

- [ ] Related issues linked using fixes: https://github.com/vercel/next.js/issues/29597
- [ ] Integration tests added
- [ ] Errors have 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.
- [x] Related issues linked using Fixes: https://github.com/vercel/product/issues/35
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-11-22 17:27:43 +00:00
Tim Neutkens
b69f3b79c5 Fix prettier linting 2021-11-21 12:58:34 +01:00
Tim Neutkens
03ce622972
Add docs for the Next.js Compiler written in Rust (leveraging SWC) (#31485)
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Lee Robinson <lrobinson2011@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-21 12:42:52 +01:00
Mathieu Céraline
a48b8db94f
Fixing typo in Documentation about Testing (#31653)
Fixing a small typo in the sentence « It is recommend.. » about Playwright.

<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order 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 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-21 06:24:40 +00:00
Kevin Wolf
af6e9e2d87
Add middleware examples to custom page extensions (#31545)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-17 18:03:02 +00:00
xuchaobei
9739e6c100
Update environment-variables.md (#31525)
Remove `NEXT_PUBLIC_` prefix for server-only enviroment vars.


## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-17 17:01:42 +00:00
Nikola Knežević
af82de4274
Fix type declaration for API Routes response (#31486)
There is missing equals sign in the type declaration in the example for API Routes.

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-11-16 17:54:53 +00:00
Gonzalo Pozzo
d550b13b8d
Script examples (#31181)
* Add script component examples

* Update script examples

* Refactor code

* Remove unused files

* Fix linter

* Fix lint error

* Fix prettier
2021-11-16 11:47:12 -05:00
Tim Neutkens
d8028f553e
Revert "Add docs for the Rust Compiler (SWC)." (#31484) 2021-11-16 10:42:45 +01:00
Lee Robinson
47aad2fafd
Add docs for the Rust Compiler (SWC). (#31467)
This clearly lists what transforms are supported, which are currently experimental, and what is still unsupported with a place to leave feedback and your existing Babel setup.
2021-11-16 09:40:28 +00:00
Abdullah Mzaien
aedb86591f
Update react-18.md (#31476)
Changing the install tags to beta since react released the [beta](https://github.com/reactwg/react-18/discussions/112) today



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-11-16 04:09:42 +00:00
Vincent Voyer
7d82e07df8
docs(auth): fix iron-session example url + API (#31413)
This fixes the iron-session example url from an old url to the new,
always-up-to-date url.

I believe the Next.js team owns the previous url but it's not up-to-date.

This commit also changes req.session.get("user") => req.session.user to reflect
the new API.
2021-11-15 14:49:15 +00:00
Bradley Turek
a47955718e
Clarify with commas (#31224)
Adds a few commas where they could improve the clarity of the sentence.

- [X] Make sure the linting passes by running `yarn lint`


Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2021-11-15 14:37:08 +00:00
Orri Arnarsson
06d4bbbb24
docs: next-iron-session renamed to iron-session (#31292)
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-15 14:12:20 +00:00
Nikola Knežević
61ca7369c6
Fix function syntax for API Routes documentation (#31414)
There is a non-valid mix of classic and arrow function notation in the documentation. I've fixed it to be a classical function notation because all the other examples are like that.

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-11-15 10:50:13 +00:00
Onur Temiz
aaec9a9353
Update image-optimization.md (#31401)
"styled-jsx" link was broken. Added `/docs/` prefix and removed `.md` suffix to fix it.

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
2021-11-14 23:13:16 +00:00
Onur Temiz
10b4deaf90
Update data-fetching.md (#31394)
Added a link to third "Internationalized Routing"



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-11-14 19:46:30 +00:00
Emmanouil Zoumpoulakis
ce3112048f
Typo fixes on Markdown files (#31380)
Some simple typo fixes on Markdown files
2021-11-14 01:56:41 +00:00
Dyar Faradj
ae72632870
Changes in dev script (package.json) (#31245)
New Next.js projects now generates "dev": "next dev"



## Documentation / Examples

- [X] Make sure the linting passes by running `yarn lint`
2021-11-11 21:12:15 +00:00
Delba de Oliveira
5e179e32b6
Testing Docs: Add links to jump to sections (#31311)
Added Playwright to the top of the page and links to help readers jump to sections. 

## 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-11 15:18:23 +00:00
ThunderMiracle
4299cc169c
docs: fix typo in css-in-js page (#31244)
## Purpose

fix minor typo in [css-in-js page](https://nextjs.org/docs/basic-features/built-in-css-support#sass-variables) 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-10 15:45:20 +00:00
Dusan Ralic
87c4d17726
Update upgrading.md (#31173)
Include required steps for the latest React and Next.js version upgrade via npm/yarn.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-08 20:53:25 +00:00
Lee Robinson
913adb8e43
Fix heading levels in URL imports docs. (#31163)
To ensure they are semantically accurate.
2021-11-08 17:51:05 +00:00
Brandon Romano
02872517b8
Include www subdomain example in Domain Routing (#30487)
* Include www subdomain example in Domain Routing

* Update comment

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-11-08 11:25:19 -06:00
Konstantin Popov
5f38b18b10
Fix minor typos (#31161)
Hello,
I've found some minor typos in the documentation, solved with this PR.
2021-11-08 11:24:53 -06:00
Houssein Djirdeh
ca41952d14
Expands next/script documentation (#31063)
This PR does the following to partially address #31062:

- Expands the [Script Component](https://nextjs.org/docs/basic-features/script) page in the core documentation
- Adds a `next/script` API reference page
2021-11-08 16:49:38 +00:00
Steven
83cd45215a
Add warning when image has unused sizes prop (#31064)
- Related to https://twitter.com/jaffathecake/status/1456579637987979265
- Closes #30640
2021-11-08 16:34:30 +00:00
Zeki
5db9d09edd
Added closing tag to <Suspense> (#30983)
There was no closing tag for the first `<Suspense>` tag.
2021-11-04 15:57:00 -05:00
Nicolas
19a6158631
Add config support for build activity indicator position (#30109)
When you edit your code, and Next.js is compiling the application, a compilation indicator appears in the bottom right corner of the page.

In some cases this indicator can be misplaced on the page, for example, when conflicting with a chat launcher. To change its position, open `next.config.js` and set the `buildActivityPosition` in the `devIndicators` object to `bottom-right` (default), `bottom-left`, `top-right` or `top-left`.

I also added the documentation for both `devIndicators.buildActivity` & the new `devIndicators.buildActivityPosition`.

## Feature

- [x] Implements a new feature
- [x] Documentation added
2021-11-03 21:17:36 +00:00
JJ Kasper
3c5d5b55c3
Add note about HMR WebSocket with express to upgrading (#30905)
x-ref: https://github.com/vercel/next.js/issues/30491#issuecomment-957865735

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-03 18:28:47 +00:00
Iris van Ollefen
d5d1bc0012
Update response-helpers.md (#30816)
In Setting the status code of a response, it says "returns a name property with the value of John Doe as a JSON response". But, the code example actually returns a message property with a different value.

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-11-02 13:08:36 +00:00
JJ Kasper
7cd9ffc519
Add note about rewrites query updating (#30747)
This adds a note for the query being updated for rewrites on static pages. 

Closes: https://github.com/vercel/next.js/issues/30720

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-11-02 10:17:09 +00:00
stef
5abfea3765
Recommend using next CLI for Docker entrypoint and not yarn (#29024)
Fixes #29023 

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [x] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
2021-11-01 20:26:14 +00:00
Jiachi Liu
4ac0227423
docs: update react 18 configuration (#30726)
* Add `next/head` as unsupported for rsc
* Change the description about `_document` page
2021-11-01 19:34:13 +00:00
Erik Hedberg
cd36e8c9d4
Fix spelling error (#30737) 2021-11-01 16:30:40 +01:00
Lee Robinson
a9ec61ea03
Add workaround for prefixing the default locale to the docs. (#30673) 2021-11-01 07:37:07 +01:00
Lee Robinson
175dd0f286
Add security notes to the URL imports documentation. (#30708) 2021-11-01 07:35:25 +01:00
JJ Kasper
900ec48c03
Add note about HMR WebSocket to upgrade guide (#30704)
Co-authored-by: Lee Robinson <me@leerob.io>
2021-11-01 07:27:04 +01:00
Julien Zapata Duque
c12ae5ea39
correct Next.js 11 upgrade instructions (#30665)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-10-30 21:20:17 +02:00
Kai Malcolm
39fcb8d338
Document Cross-Platform VS Code Debugging (#30052)
This PR adds documentation on how to debug through VS Code on Windows. Closes #30231

## Documentation / Examples

- [x] Make sure the linting passes
2021-10-28 10:59:31 +00:00
Lucas Vazquez
790261682b
Update examples at headers documentation (#30502)
Several examples at https://nextjs.org/docs/api-reference/next.config.js/headers have a comma at the end of the returns, which makes them invalid examples.
2021-10-28 03:20:05 +00:00
Balázs Orbán
574651adfd
docs: update Middleware API reference (#30485)
I changed the order of `NextRequest` and `NextFetchEvent` as they are presented in the function signature.

There also seemed to be some issues with the heading levels.

Also, `NextResponse` is a documented API, but the example code uses `Response`. I wasn't sure if this was a mistake in the docs or in the code.

I noticed that other similar docs pages have a collapsible `Examples` section at their top:

- https://nextjs.org/docs/api-reference/next/image
- https://nextjs.org/docs/api-reference/next/head
- https://nextjs.org/docs/api-reference/next/amp

Image below:
![image](https://user-images.githubusercontent.com/18369201/139145600-9f45d5be-b11c-4780-be95-c7f2ebeb49a9.png)

Should the Middleware docs have the same?
2021-10-27 21:08:54 +00:00
Luke Howsam
e82958ca78
fix(docs): Fix broken link in testing documentation (#30448)
This PR: 
Fixes a broken link in the testing documentation. It appears that the selector currently being used is `#test-environment-variable`. When clicked this results in the user being re-directed to the top of the environment variables page. The correct selector is: `#test-environment-variables`

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-10-27 15:53:57 +00:00
Bruce Rodrigues
8316b8df43
Removing duplicated instead word (#30442)
Just removing the duplicated use of `instead` on `next.config.js/rewrites`  doc
2021-10-27 15:29:54 +00:00
Steven
3bdf80dde5
Fix PerformanceObserver usage for older browsers and CI (#30387)
Browsers older than 2017 don't have PerformanceObserver https://caniuse.com/mdn-api_performanceobserver


- Fixes https://github.com/vercel/next.js/issues/30322
- Fixes https://twitter.com/fmgordillo/status/1453037730141716492
2021-10-27 00:37:19 +00:00
Matt Wood
7e9f801b47
Fix typo currentFeatures to concurrentFeatures (#30356)
* Fix `currentFeatures` to `concurrentFeatures`

Small typo fix in docs

* Apply suggestions from code review

Co-authored-by: Shu Ding <g@shud.in>

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Shu Ding <g@shud.in>
2021-10-26 14:16:29 -05:00
Rich Haines
a4a77595de
Added warning about trusted domains (#30348) 2021-10-26 20:55:21 +02:00
JJ Kasper
c7e4c85436
Fix lint on react-18 docs (#30354) 2021-10-26 20:54:38 +02:00
Leo Gaskin
d92e75cb30
Add missing closing quote (#30336) 2021-10-26 13:54:56 -04:00
JJ Kasper
4edc874ee5
Add React 18 docs (#30325)
This re-adds https://github.com/vercel/next.js/pull/30324 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-10-26 16:30:45 +00:00
Tim Neutkens
c217900fa0
Update manifest.json 2021-10-26 18:03:53 +02:00
Lee Robinson
3466b740ae
Add more docs (#30320)
Co-authored-by: Steven <steven@ceriously.com>
2021-10-26 11:07:32 -04:00
Steven
4782cacecf
Add warning when LCP image is missing priority prop (#30221) 2021-10-25 17:59:00 -04:00
Kara
2fe5d011e6
Add "priority" section to Image Optimization doc (#30218)
This change addresses some feedback that some users don't realize
that the `priority` attribute exists and is critical for managing
LCP when using the next/image component. It adds a dedicated
section to the Image Optimization doc that explains how and when
to use the attribute.

Fixes #29624

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2021-10-25 21:04:00 +00:00
Tim Neutkens
f5b7baca53
Add note about improved CSS parser for styled-jsx to upgrading guide (#30280)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-10-25 20:29:08 +00:00
matamatanot
25716a249d
Fix typo of upgrading (#30276)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-10-25 19:18:45 +00:00
Tim Neutkens
dfb280b4a9
Add minimum Node.js version to upgrading guide (#30274)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2021-10-25 18:38:48 +00:00
Tim Neutkens
3f22451545
Update upgrade docs (#30265)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Steven <steven@ceriously.com>
2021-10-25 20:20:11 +02:00
Tobias Koppers
04e1e01f18
test, fix and document all possible import types for URL imports (#30165)
resolve absolute URLs in CSS when using urlImports
remove `[path]` from static static image output path
replace file-loader with asset module, remove file-loader
2021-10-25 01:54:16 +02:00
JJ Kasper
9d4e7b45dc
Add initial documentation for output file tracing (#30199)
* Add initial documentation for output file tracing

* Apply suggestions from code review

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Steven <steven@ceriously.com>
2021-10-24 10:39:22 -05:00
Steven
ca65fd8f87
Change AVIF to opt-in via configuration (#30180)
AVIF (shown in purple) is generally slower to encode than WebP (shown in yellow) so it is probably not a good default for on-demand Image Optimization.

Instead, we'll let users opt-in via `formats` configuration.

![performance](https://user-images.githubusercontent.com/229881/138511198-b987d307-17c2-47c2-816f-766a43d77efd.png)
2021-10-22 21:08:03 +00:00
Steven
6f3e9470a6
Ensure error message prints next.config.mjs (#30152)
This PR ensures we print the correct error message for either `next.config.js` or `next.config.mjs`, whichever was detected.
2021-10-21 23:04:40 +00:00
Tobias Koppers
d07107f2c6
add experimental.urlImports option (#30079)
Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: Rich Haines <hello@richardhaines.dev>
2021-10-21 13:14:57 +02:00
Steven
dda14e7f4b
Add image example with background color using blurDataURL (#30111)
Demo: https://nextjs-examples-image-component-igy6n5cs1.vercel.sh/
2021-10-20 19:05:54 +00:00
Steven
f2cf092ee6
Print error when images.loader is assigned but images.path is not (#30080)
Fixes #29744
2021-10-20 00:17:24 +00:00
Tim Barley
b794c171f2
Update eslint.md with instructions for installing Prettier plugin dependency (#29764)
Added install instructions for eslint-config-prettier before adding Prettier to the ESLint config.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [X] Make sure the linting passes
2021-10-18 22:35:46 +00:00
Steven
1a0c1e8a5b
Fix next/image when parent is <p> (#30041)
- Fixes #29717 
- Fixes #21433 
- Closes #21475
2021-10-18 21:29:19 +00:00
kimizuy
cf5eededc9
docs: Remove invalid link "Glamor" (#29982)
Remove an invalid link.
`with-glamor` example does not exist.

## Documentation / Examples

- [x] Make sure the linting passes
2021-10-17 15:15:05 +00:00
matamatanot
067075ca07
Update minimum Node version in Getting Started (#29952)
Follow up to #29949 

## Documentation / Examples

- [x] Make sure the linting passes
2021-10-15 21:48:13 +00:00
JJ Kasper
c2b5f15c93
Update typo in response helpers doc (#29899)
Fixes typo per https://github.com/vercel/next.js/pull/29462#discussion_r728604242

## Documentation / Examples

- [x] Make sure the linting passes
2021-10-14 04:23:47 +00:00
Steven
fcc8380642
Update docs for image caching behavior (#29895)
Revises docs to explain that the maximum of the header and config is used.
2021-10-14 00:01:17 +00:00
Angelo P
541259d992
Update testing based on Failed to parse src "test-file-stub" on `next… (#29039)
…/image` Error

While learning how to test next.js applications I came across this error when testing components using next/image with an image import

eg: 
```
// /quiz-hero
import Image from 'next/image';
import quizImage from '../../public/undraw-quiz.svg';

// In render 
<Image
              height='91'
              width='198'
              layout='fixed'
              src={quizImage}
              alt='QuizImage'
            />
```

### Error -> 
Failed to parse src "test-file-stub" on `next/image`, if using relative image it must start with a leading slash "/" or be an absolute URL (http:// or https://)

This is fixed by adding a "/" to the beginning of your file-stub module export string. 

This is not an error when you're awaiting an image using async waitFor, But comes up as an error when you're testing a component that holds another component with a "next/image" import.
eg: 
```
// quizHero.test.tsx works like this without change.
const image = await waitFor(() => screen.findByAltText('QuizImage')); 

// but index.test.tsx fails rendering the homepage without the change.
render(<Home />); // Error: Failed to parse src "test-file-stub" on `next/image`...

// with change to __mocks__/fileMock
quizHero.test.tsx //test pass
index.test.tsx //test pass
```
<!--
Thanks for opening a PR! Your contribution is much appreciated.
In order 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

possibly related to -> #26749

## Feature

- [X] Documentation added

## Documentation / Examples

- [X] Make sure the linting passes
2021-10-13 15:13:24 +00:00
Rich Haines
eed43115ec
Added more examples to Response Helpers page (#29462)
## Bug

- [x] Related issues linked using Fixes: https://github.com/vercel/front/issues/11154
- [ ] Integration tests added
- [ ] Errors have 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
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-10-13 14:58:18 +00:00
Phattarapol L
5d992a6a28
Add Scss variables section to Built-in CSS Support document (#29822)
## Feature

- [x] Documentation added

## Documentation / Examples

- [x] Make sure the linting passes
2021-10-12 14:33:12 +00:00
Max Schmitt
ca062db2a4
docs(testing): added Playwright guide (#29832)
Blocked by https://github.com/vercel/next.js/pull/29426
2021-10-12 14:21:54 +00:00
Steven
cc1f3b8a38
Add support for AVIF to next/image (#29683)
Add support for AVIF to `next/image`

- Fixes #27882 
- Closes #27432 

## Feature

- [x] Implements an existing feature request
- [x] Related issues linked
- [x] Integration tests added
- [x] Documentation added
- [x] Update manifest output
- [x] Warn when `sharp` is outdated
- [x] Errors & Warnings have helpful link attached
- [ ] Remove `image-size` in favor of `squoosh`/`sharp` (optional, need to benchmark)
2021-10-11 23:17:47 +00:00
Kristopher Wuollett
049e17566b
Fix test running command in testing.md (#29778)
* The previous `npm run jest` command did not match up with the testing script added to the example `package.json`
* Fixes #29777



## Bug

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

## Documentation / Examples

- [ ] Make sure the linting passes
2021-10-10 14:09:35 +00:00
Igor Agapov
bdfc4c2e9c
Fixed method for removing class (#29735)
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-10-08 15:17:41 +00:00
Henry Blevins
8b485e161d
Fix typo in image optimization documentation (#29685)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-10-06 18:57:33 -05:00
Aryan Beezadhur
c70931bc19
Grammatical fixes (#29676) 2021-10-06 18:59:47 +00:00
Steven
e29b44b368
Fix debugging docs markdown lang (#29674)
Fixes an error rendering docs:

```
Markdown to HTML error: Error: Unknown language: `shellsession` is not registered
```
2021-10-06 17:41:56 +00:00
Kai Malcolm
9c0578519d
Document i18n routing with dynamic routes (#29632)
* Document i18n routing with dynamic routes

* Update i18n-routing.md

* lint-fix

* Fix i18n Routing Typo

* Update i18n-routing.md

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-10-05 18:36:16 -05:00
Alex Castle
5d7b68f15e
Overhaul image component documentation (#29186)
This PR contains an overhaul of the image component documentation for next (both the [primary usage doc](https://nextjs.org/docs/basic-features/image-optimization) and the [API reference](https://nextjs.org/docs/api-reference/next/image)). This PR does not change the filepath/URL for either of those documents, but that may still be warranted as right now Google searches for "next.js image component" and the like return the API document as the first result, which is not optimal.

The changes to the docs are based on feedback from the community and with input from @leerob. I'm marking this PR a draft because we will likely want to have a round of revisions before merging, but in general I consider this PR "read to go," contingent on buy-in from other stakeholders.

The basic goal of the changes are as follows:
1. Simplify the getting started page by moving extraneous detail to the API documentation.
2. Refocus the getting started page on practical usage information
3. Add additional content to address issues that have come up as common pain-points around the image component, such as image sizing and styling.

Fixes #21786 

CC: @styfle @timneutkens @kara @spanicker
2021-10-05 21:38:48 +00:00
Arthur Denner
1c1929b3a5
docs: remove this usage from function component (#29596)
Fix a small error in the `next/script` docs.

Let me know if you'd like a `useState` for the sake of a complete example.



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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 helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
2021-10-04 12:02:57 +00:00
Ty Mick
c06a3c1731
docs: Clarify locale properties on context object in data-fetching (#29566)
Until I started looking into the source code to verify, I thought that `locale`, `locales`, and `defaultLocale` were being parsed from the [`Accept-Language`][1] header somehow. This'll help other people like me who are reading the [Data Fetching](https://nextjs.org/docs/basic-features/data-fetching) page but weren't already aware of Next.js's [Internationalized Routing](https://nextjs.org/docs/advanced-features/i18n-routing) features.

[1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language



## Documentation / Examples

- [x] Make sure the linting passes
2021-10-04 09:25:38 +00:00
Tim Neutkens
9581658b8a
Use npx create-next-app@latest instead of the version that is installed (#29595) 2021-10-04 11:13:45 +02:00
JJ Kasper
a9ad8cbbd9
Update permanent redirect field documentation (#29557)
This explains what the permanent field does a bit more for redirects. 

## Documentation / Examples

- [x] Make sure the linting passes

x-ref: https://github.com/vercel/next.js/discussions/29556
2021-10-04 08:28:35 +00:00
Ty Mick
667ddad6aa
docs: Link to getInitialProps on Custom App page (#29567)
`getInitialProps` is already being referenced on the [Custom `App`][1] page, since it's the only supported data-fetching method for custom `App` components, but folks who started using Next.js after the advent of `getStaticProps` and `getServerSideProps` may not be familiar with the `getInitialProps` API.

[1]: https://nextjs.org/docs/advanced-features/custom-app



## Documentation / Examples

- [x] Make sure the linting passes
2021-10-02 21:39:08 +00:00
Vitor Balocco
2f26fb440f
Update getServerSideProps docs with req.cookie note (#29457)
## Documentation / Examples

Add a note to the `getServerSideProps` docs that `context.req` [contains](c27e3a41dc/packages/next/types/index.d.ts (L148-L150)) a `context.req.cookies` attribute.

I based the copy off of the one from https://nextjs.org/docs/api-routes/api-middlewares.

Checklist:
- [x] Make sure the linting passes
2021-09-30 15:34:03 +00:00
Kyle Holmberg
e5960dc6d6
Add Stitches example to CSS-in-JS docs (#29498)
CC @peduarte
2021-09-29 16:50:41 +00:00
Lee Robinson
7f99895076
Update imperative routing docs to have better a11y (#29382)
We should recommend using a `button` instead of a `span` 👍
2021-09-27 02:04:58 +00:00
Casper
9343b67c11
feat: allow setting custom tsconfig file (#28104)
Ability to provide a custom tsconfig file. 

**Example Usage:**

```js
// next.config.js
module.exports = {
	typescript: {
		tsconfigPath: "myconfig.json"
	}
}
```


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have 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.
- [x] Related issues linked using [`fixes #23972 (discussion)`](https://github.com/vercel/next.js/discussions/23972)
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes
2021-09-23 22:52:05 +00:00
JJ Kasper
f8e283c7ba
Ensure href/as behavior points to correct docs (#29270)
Adds an additional note about `href`/`as` behavior so that users understand which docs should be looked at for how they are using it. 


## Documentation / Examples

- [x] Make sure the linting passes


x-ref: https://github.com/vercel/next.js/issues/26169#issuecomment-924206396
2021-09-22 19:07:07 +00:00
Lee Robinson
638e6ccfde
Update Gatsby migration guide to use image imports. (#29178)
* Update Gatsby migration guide to use image imports.

* Update docs/migrating/from-gatsby.md

* Update docs/migrating/from-gatsby.md

Co-authored-by: Steven <steven@ceriously.com>

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-09-19 00:12:31 -05:00