Commit graph

1073 commits

Author SHA1 Message Date
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
Konstantin Popov
2333f7c1b8
Fix minor typos (#29188)
Fix minor typos:

typescript -> TypeScript
2021-09-17 23:00:20 +00:00
x4th
37c66dcd84
Update router.prefetch section to clarify it supports dynamic routes (#29070)
* Update router.prefetch section to clarify it supports dynamic routes

* Apply suggestions from code review

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-09-17 11:18:02 -05:00
Colin Sidoti
713a5aa701
Use new @clerk/nextjs package in with-clerk example, update Next.js authentication docs (#28906)
* Update headings to clarify that we're describing. Add heading for Authentication API Routes

* Start adding API route examples

* Start adding API route examples

* Start adding API route examples

* Start adding API route examples

* auth: Replace clerk packages with @clerk/nextjs

* Add API authentication example to with-clerk

* Fix footer links

* Proofread, ensure consistency

* Update example's props to use new version

* Update example links

* Add rel tag to _blank link

* Obscure the authentication provider in the example

* Replace example

* Reset authentication docs, list Clerk as vendor

* Re-fix typo

* Change sample to example

* Add the example

* Update examples/with-clerk/package.json

Co-authored-by: Lee Robinson <me@leerob.io>

Co-authored-by: Peter Perlepes <p.perlepes@gmail.com>
Co-authored-by: Lee Robinson <me@leerob.io>
2021-09-17 10:54:34 -05:00
JJ Kasper
cefd9cf283
Add crawler blocking for fallback: true (#29121)
* Add crawler blocking for fallback: true

* update test

* Update check

* Add note to docs

* use browser agent for non-crawler test
2021-09-16 11:01:28 -05:00
Ty Mick
c7e187f893
Add client-side debugging instructions (#28815)
Fixes #16442

The current instructions on the Debugging page currently only work for server-side code, and furthermore, the page doesn't actually _say_ that they only work for server-side code.

This update adds instructions for debugging client-side code in both VS Code and Chrome DevTools. It also improves the suggested VS Code launch configurations to take advantages of some relatively recent features in VS Code's [built-in JavaScript debugger][1]. Using the `node-terminal` and `pwa-chrome` launch types removes the need to manually pass an `--inspect` flag to the underlying Node.js process.

[1]: https://github.com/microsoft/vscode-js-debug

Let me know if there are any edge cases I didn't consider with these VS Code launch configs!



## Documentation / Examples

- [x] Make sure the linting passes
2021-09-16 07:07:56 +00:00
Lee Robinson
a5bc3f2f8c
Add note about using Sharp for next/image to deployment docs. (#29067)
I also removed the custom server link here, because I think it's making too strong of a correlation between custom server and Node.js server using `next start`, which aren't the same.
2021-09-13 20:31:04 +00:00
volcareso
48b37ede23
Add more examples of static generation to docs page. (#29052)
## 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-09-13 13:18:31 +00:00
volcareso
e09b7a5827
Fixed typo (#28989)
Added () outside *demo"



## 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-09-10 12:18:43 +00:00
Nwachukwu Daniel (DONSN)
248c6fc88d
Fixed issue with grammar (#28964)
Changed - function component to - functional component in the heading and sentence below:

If the child of `Link` is a functional component, in addition to using `passHref`, you must wrap the component



## 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-09-09 14:24:01 +00:00
scottrepreneur
ee71f9d863
name should be key (#28917)
Small fix on parameter expecting to be de-duped
2021-09-08 14:00:34 +00:00
Lee Robinson
1fcd8c2e4d
Update next/link API docs to mention a11y and ESLint rule. (#28841)
Based on feedback from Twitter. 

https://twitter.com/marcysutton/status/1431432062506917890
2021-09-07 15:10:27 +00:00
Alex Vilchis
2425f4703c
(docs) Add permanent property in redirect object (#28852)
I found that an example for a redirect rule in the documentation doesn't have the required property `permanent`. I noticed this because I tried to use that same rule but building fails with the following message:

```
`permanent` is not set to `true` or `false` for route {"source":"/:path((?!another-page$).*)","has":[{"type":"host","value":"example.com"}],"destination":"/another-page"}


Error: Invalid redirect found
```

My PR simply adds the missing `permanent` property as false to be consistent with the rest.

## Documentation / Examples

- [x] Make sure the linting passes
2021-09-06 23:20:15 +00:00
Alex Vilchis
947db315cf
(docs) Remove duplicate comma (#28850)
- [X] Make sure the linting passes
2021-09-06 18:31:31 +00:00
Woosik Kim
970f85e40c
doc: fix typo (#28817)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-06 13:42:18 +02:00
Lee Robinson
602b26b4b9
Add note to Gatsby migration guide about using next/image with custom loaders. (#28805)
Feedback from this article: https://blog.whereisthemouse.com/image-optimization-for-static-nextjs-sites
2021-09-06 11:34:22 +00:00
Houssein Djirdeh
4141aaefa5
[ESLint] Support single-file linting in next lint (necessary for lint-staged) (#28042)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-06 13:05:40 +02:00
Steven
801e48eae9
Update docs to clarify that image imports are static (#28744)
This PR clarifies the usage for static image imports.
2021-09-02 18:51:30 +00:00
Alex Castle
c9efbe1818
Update image styling doc (#28724)
In talking to partners, I've seen a lot of confusion about the number of wrapping `<div>`s around the image element rendered by `next/image`. There's always just one single wrapper--this PR updates the docs to make that a little more explicit.
2021-09-02 05:48:55 +00:00
Aleksa Cukovic
501bfe6969
Update docs about exposing env vars to the browser (#28673)
Current docs on exposing environment variables to the browser are slightly misleading as they say that variables loaded from `.env.local` are only available in node by default, but this is the case for all environment variables not just those loaded from `.env.local`.

## Documentation

- [x] Make sure the linting passes
2021-08-31 21:18:22 +00:00
Kara
9be387c7f4
getServerSideProps should support props value as Promise (#28607)
Previous to this change, getServerSideProps could only return plain objects
for props, e.g.:

```javascript
export async function getServerSideProps() {
  return {
    props: {
      text: 'some value',
    }
  }
}
```

With this commit, the props object can also be a Promise, e.g.

```javascript
export async function getServerSideProps() {
  return {
    props: (async function () {
      return {
        text: 'promise value',
      }
    })(),
  }
}
```

For now, the framework simply waits for the results of the props Promise to resolve,
but this small change sets the groundwork for later allowing props to be streamed (cc @devknoll).

## Feature

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. -- *This is part of @devknoll's ongoing work to support streaming.*
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not. *not sure if this applies here*
- [ ] Errors have helpful link attached, see `contributing.md`
2021-08-30 19:52:15 +00:00
Mike Hedman
d209435724
Small grammar fixes (#28590)
"exclusive of" implies that it doesn't pertain to `export` https://www.merriam-webster.com/dictionary/exclusive%20of  "Exclusive to" implies that it's only relevant to `export`.  
Also changed "can not" to "cannot".



## 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-08-28 21:56:32 +00:00
Scotty Waggoner
04cc37f763
Add docs for using pageExtensions to colocate other files with page components (#22740)
Feel free to edit this/suggest changes as you see fit to match the style of your docs or how you want this feature represented.

There seemed to be many issues regarding colocating non-page files with page components in  the `pages` directory where `pageExtensions` was finally suggested as a solution. I think it would be great to document it better since it seems to be a often requested workflow to colocate test, generated files, styles, and other files needed by page components in the `pages` directory. The note that exists in the docs currently alludes to the ability to do this but it doesn't contain much context that would help make it more discoverable.

Relevant issues:
https://github.com/vercel/next.js/discussions/11113#discussioncomment-427139
https://github.com/vercel/next.js/issues/8454#issuecomment-560432659
https://github.com/vercel/next.js/issues/8617#issuecomment-790030032
https://github.com/vercel/next.js/issues/3728#issuecomment-523789071
2021-08-27 22:58:56 +00:00
Delba de Oliveira
27c2937cc7
Update with-jest packages and docs (#28209)
This PR updates the with-jest example to the latest version of Jest and adds a note about the Jest and RTL testing environments (related to this [discussion](https://github.com/vercel/next.js/discussions/28337)). Also adds minor tweaks to the testing docs. 


## 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
2021-08-26 16:18:22 +00:00
Hunter Tunnicliff
877f982924
Use recommended pattern in testing example (#28404)
* Use recommended pattern in testing example

Since the official linter for testing library, `eslint-plugin-testing-library` recommends using `screen` to write queries, this MR updates the testing library example to follow the pattern recommended by the linter.

> DOM Testing Library (and other Testing Library frameworks built on top of it) exports a screen object which has every query (and a debug method). This works better with autocomplete and makes each test a little simpler to write and maintain.

> This rule aims to force writing tests using built-in queries directly from screen object rather than destructuring them from render result. Given the screen component does not expose utility methods such as rerender() or the container property, it is correct to use the render returned value in those scenarios.

See the `prefer-screen-queries` rules docs for more info: https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-screen-queries.md

* Update devDependencies

* Install and configure test linting

* Use recommended pattern in test

* Update test names for consistency

* Update docs

* Set jest environment in each file

* Use root true in `with-jest` eslint config

* Ensure nested .eslintrcs are not loaded for repo lint

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-08-25 12:33:57 -05:00
JJ Kasper
f21685549a
Update i18n locales limit to warning (#28429)
* Update i18n locales limit to warning

* update version -> versions

* bump

* Use Log.warn instead

* Apply suggestions from code review

Co-authored-by: Lee Robinson <me@leerob.io>


Co-authored-by: Lee Robinson <me@leerob.io>
2021-08-25 08:54:38 -05:00
Steven
cb6290adf3
Update docs for sharp usage to mention Vercel (#28476)
There was some confusion in [this tweet](https://twitter.com/mtliendo/status/1430269174459338759) so I revised the docs around `sharp` usage.
2021-08-24 22:51:28 +00:00
Robbie Averill
57965770b9
Minor docs edit: cors -> CORS (#28472)
## Documentation / Examples

- [x] Make sure the linting passes
2021-08-24 17:23:40 +00:00
Houssein Djirdeh
80921b6a54
enables eslint caching by default (#28349)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-08-23 12:56:21 -05:00
Lee Robinson
8afa24fca5
Improved next/image docs around layouts. (#28345)
There's been community feedback the `layouts` section of `next/image` docs could be improved. Thanks to this great article (https://blog.eyas.sh/2021/08/gatsby-to-next-js/), I've added a helpful table here giving a high-level overview, as well as re-organized the `layout` section to be more helpful.
2021-08-23 17:39:19 +00:00
Kornel Dubieniecki
d143d9879f
docs: update font-optimization.md (#28397)
Adding display property to the examples as just copying them shows a 'Display parameter is missing.' warning.
Also added a link to the docs.

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-23 16:07:54 +00:00
Behzad Mehrabi
d6e82484f4
fix link to global stylesheet in from-create-react-app.md (#28327) 2021-08-20 12:18:27 +00:00
Aryan Beezadhur
864a1893c3
Update supported-browsers-features.md (#28326) 2021-08-20 11:52:20 +00:00
stefanprobst
da4203d032
Add eslint rule for id attribute on inline next/script (#27853)
This adds a new ESLint rule to `eslint-plugin-next` to check that `next/script` components with inline content have the required `id` attribute.

Also adjusted the code example for inline scripts in the `next/script` docs, which were actually missing an `id` attribute.
And also updated the `next/scripts` integration test to also have the required `id` attribute.

Unsure about the required heading levels in the errors .md document (other examples have h1 and h4??)

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

## Documentation / Examples

- [ ] Make sure the linting passes
2021-08-19 20:08:04 +00:00
Brody McKee
0d3fb75cb6
Add docs for ESLint plugin settings and rule options (#28059)
This PR adds documentation for the new `rootDir` setting (#27918), and for `next/no-html-link-for-pages`.

## Documentation / Examples

- [x] Make sure the linting passes
2021-08-19 09:07:30 +00:00