Commit graph

7913 commits

Author SHA1 Message Date
Tim
1f5c2c8513
Add example prepr cms (#22776)
Added preview example with Prepr CMS.

Working demo at https://next-blog-prepr.vercel.app/
2021-03-04 19:12:42 +00:00
NkxxkN
f00f4bd912
Examples bump supertokens (#22764)
Hey team!
We are updating the `with-supertokens` example to reflect the use of credentials alongside third party login

See: 
![image](https://user-images.githubusercontent.com/5072452/109943811-dd714b80-7cd5-11eb-91b5-5a966a1c1e2d.png)

This PR bumps the versions and add a base example implementation.
2021-03-04 14:18:19 +00:00
Joe Haddad
2046648fa7
v10.0.8-canary.15 2021-03-03 14:53:19 -05:00
Joe Haddad
61dae380a8
chore: upgrade webpack 5 version (#22737) 2021-03-03 19:52:20 +00:00
JJ Kasper
ce400b2678
Update NEXT_LOCALE cookie note (#22736)
This updates the `NEXT_LOCALE` cookie docs to mention how it is used for redirecting from `/` more specifically. 

x-ref: https://github.com/vercel/next.js/pull/20045#discussion_r586158535
2021-03-03 19:30:01 +00:00
JJ Kasper
1435de15bc
Ensure component load order (#22731)
This ensures we load `_document` then `_app` and then the page's component in all cases which matches behavior between the serverless target and the default server target.  Additional tests to ensure this order is followed has been added to prevent regression. 

Fixes: https://github.com/vercel/next.js/issues/22732
2021-03-03 19:20:48 +00:00
Grigory
e04d399ab5
Add missing dependencies in example (#22712)
@babel/plugin-proposal-class-properties is missing in with-mobx-react-lite example
2021-03-03 13:23:53 +00:00
Chris Meagher
bdc20c2657
Add Azure Pipelines example to no-cache docs (#22708)
I added this in to my own pipeline to fix the no-cache error and thought it may be of use to others.
2021-03-03 09:47:19 +00:00
Tim Neutkens
5b479b609a v10.0.8-canary.14 2021-03-03 10:39:10 +01:00
JJ Kasper
b80fdfb828
Update webpack server chunks output (#22697)
This updates to output server chunks to a nested folder to prevent bundling the entire folder when tracing. This also fixes the webpack 5 tests not actually using webpack 5 since https://github.com/vercel/next.js/pull/22583 since the webpack 5 enabling check didn't account for the test environment variable used to enable webpack 5. This also clears up some deprecation warnings from webpack 5 in the mini-css-extract-plugin.

Fixes: https://github.com/vercel/next.js/issues/21297
2021-03-03 09:37:24 +00:00
JJ Kasper
ac47795d37
v10.0.8-canary.13 2021-03-02 13:55:31 -06:00
JJ Kasper
e037c22997
Ensure optional params are normalized in minimal mode (#22676) 2021-03-02 13:51:53 -06:00
Janicklas Ralph
a107dcb732
Experimental script loader changes (#22038)
Making experimental script work in _document.js - Fixes for server to client transition
Adding additional test for _document.js
2021-03-02 19:17:33 +00:00
Joe Haddad
103422ce70
v10.0.8-canary.12 2021-03-02 13:20:40 -05:00
Lee Robinson
006eba3225
Add note for using getStaticProps with 404.js (#22693)
Help clarify that this option is available!
2021-03-02 17:09:54 +00:00
Yasser A.Idrissi
8dfe5a3bd5
deps(examples/hello-world): Upgrade to React v17 (#22692) 2021-03-02 16:44:39 +00:00
Yann Pringault
1352ba1dcf
[examples/with-typescript] Upgrade to React v17 (#22674)
This avoids the warning when you init a new Next.js app with the example:

```
warn  - React 17.0.1 or newer will be required to leverage all of the upcoming features in Next.js 11. Read more: https://err.sh/next.js/react-version
```
2021-03-02 14:10:38 +00:00
Lee Robinson
b874bc7f82
Add note about preloading to routing introduction. (#22656)
Preloading is mentioned in the `next/link` docs, but not in the routing introduction.
2021-03-02 03:17:43 +00:00
Ålex
5b0ed99093
Fix grammar in next/amp API reference (#22653)
Change 'an' of "The page has an user-accessible" to 'a'.
2021-03-02 00:33:09 +00:00
Joe Haddad
72ce0173e1
v10.0.8-canary.11 2021-03-01 14:00:25 -05:00
dominicfraser
86ce29b34a
Update authentication.md SSR example (#22641)
There are two examples, one (a) for "Authenticating Statically Generated Pages" and one (b) for "Authenticating Server-Rendered Pages".

(a) uses a sudo `useUser` hook to fetch the user client-side.

It looks like the example for (b) was copied and pasted then edited from (a), but in (b) this `useUser` hook is not used (instead using `req.session.get('user')`).

This PR simply removes the unused import in the (b) example.
2021-03-01 16:44:32 +00:00
Lee Robinson
eb79218b7d
Add note about other redirects to next.config.js docs. (#22640)
In case a user lands on this page via search or from Google, we should mention the other ways you can redirect with Next.js.
2021-03-01 16:33:04 +00:00
NkxxkN
293c243ab7
add-supertokens-to-authentication.md (#22223)
Hey team. This PR is a follow up on https://github.com/vercel/next.js/pull/21384 to add a reference to `with-supertokens` example to authentication doc.
2021-03-01 15:53:17 +00:00
Joe Haddad
7aaebee14e
v10.0.8-canary.10 2021-03-01 09:17:17 -05:00
Rostyslav Sipakov
4e9c5eeae0
Fix typescript-eslint-jest example to remove Prettier package causing errors (#22452)
Delete "prettier/@typescript-eslint" from .eslintrc.json. 

After update to the last version I getting this error on running lint: ESLint couldn't find the config "prettier/@typescript-eslint" to extend from. 
I explore this issue https://github.com/prettier/eslint-config-prettier/pull/175 and I think those extensions aren't needed anymore.
2021-03-01 02:43:23 +00:00
Lee Robinson
0a35b578d4
Add use cases for API Routes to documentation. (#22616)
I've seen this confusion come up a few times, specifically [here](https://www.reddit.com/r/nextjs/comments/lsmpon/is_there_a_benefit_to_using_api_when_you_are_only/) for the latest.
2021-03-01 01:15:14 +00:00
Nick Babcock
6c59b77702
Switch to stable rust for with-webassembly example (#22582)
Since Rust 1.30 (released Oct 2018), the wasm target is supported on stable.

ref: https://rustwasm.github.io/book/game-of-life/setup.html#the-rust-toolchain
2021-02-27 21:48:49 +00:00
Joe Haddad
04f37d0978
fix: load webpack hook before config is required (#22583)
This pull request ensures the webpack hook is installed before an attempt is made to load the configuration.

This pull request is tested by the PnP tests, which should now be passing as a result of this change.

---

Fixes #21679
2021-02-27 06:19:35 +00:00
Jan Potoms
1ebc9bbb5e
Load next.config.js async (#22578)
Just the conversion of config loading from sync to async from https://github.com/vercel/next.js/pull/22153

cc @Timer
2021-02-27 00:29:32 +00:00
devuxer
a289d38057
Simplify code examples for dynamic API routes (#22546)
Deep matching destructuring syntax is hard to understand and read vs. `const { ... } = req.query`.
2021-02-26 18:43:41 +00:00
Slawa Pidgorny
1ba5c0acc7
Add link to TypeScript docs from API Routes section (#22564) 2021-02-26 13:39:16 +00:00
LUIS ANAYA
66d2eae2c1
Update the react-three-js example. (#22549)
- Removed deprecated drei dependency. 
- Added @react-three/drei and updated imports. 
- Upgraded other dependencies to latest versions.
2021-02-25 23:22:35 +00:00
Adrien MILLE
7380f20cdb
Forward log argument from loadEnvConfig to processEnv (#22440)
We do have a third argument on `processEnv` to customize the console instance, however `processEnv` relies on `processEnv` which also have the same argument for the same purpose but it's not forwarded from `processEnv`. 

Was there a purpose for it to be left out ? If not I would expect it to be forwarded 😄 

Closes: https://github.com/vercel/next.js/pull/21788
2021-02-25 19:30:38 +00:00
lindsaylevine
b1a1c80e7c
bug (#21943): remove incorrect rewrite of parsedUrl.pathname in serverless handler (#22445)
Fixes https://github.com/vercel/next.js/issues/21943

i confirmed in a personal test repo that this solves the issue of infinite 307s on root level non-default locales :)  let me know what else this needs if anything! thanks for the time/help @ijjk ❤️
2021-02-25 18:43:51 +00:00
Alex
69fe678ea9
docs(deployment): Update user ownership in docker deployment docs (#22539)
After testing the new docker deployment documentation, ran into the following error when running the container if you're using `next/image`:

```
[Error: EACCES: permission denied, unlink '/app/.next/cache/images/2+fKe4RlpMaSTNc8npKwiCItZgik9aOX9qkxnVSrsUo=/1613616499089.3hEMhfux5+SolMDEVHEaVPK2O0OlcLoYNao0yKpmYeg=.webp'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'unlink',
  path: '/app/.next/cache/images/2+fKe4RlpMaSTNc8npKwiCItZgik9aOX9qkxnVSrsUo=/1613616499089.3hEMhfux5+SolMDEVHEaVPK2O0OlcLoYNao0yKpmYeg=.webp'
}
```

This change gives the user correct ownership to have the correct permissions.
2021-02-25 17:16:10 +00:00
JJ Kasper
0088caa1ea
v10.0.8-canary.9 2021-02-25 09:36:47 -06:00
JJ Kasper
6d068aed4f
Fix experimental optimizeCss for SSR (#22513)
This ensures `distDir` is set under `renderOpts` in `next-server` so that it is present when experimental `optimizeCss` is enabled. 

x-ref: https://github.com/vercel/next.js/pull/16539
2021-02-25 09:56:11 +00:00
Noah Fischer
c81eadc6dc
moving to upstash and new integration (#22436) 2021-02-24 23:51:41 +00:00
Alex Castle
a0d44ca311
Allow smaller sizes in srcset for image with fill layout and sizes prop (#21670)
Currently, the image component doesn't handle use of the `sizes` property with `layout="fill"` and `layout="responsive"` very well for small viewports. It will never include sizes smaller than the smallest viewport (640px) in the srcset, so even if you specify `sizes="30vw"` in your image, you have to download the full-viewport-width image on small devices. 

This PR adds logic such that if you use `layout="fill"` and include a `sizes` property, the image component will include the full range of image sizes in the `srcset`.

It also includes an optimization where it finds the smallest `vw` value in the sizes value and combines that with the smallest viewport width, and uses that as the floor of the srcset. It does this so it doesn't unnecessarily increase transfer size by including ALL sizes. This is still a conservative optimization--for 95% of cases, taking the _largest_ `vw` size would work, but I don't see a way to do that without breaking a few corner cases.

The case of a sizes prop with `px` values is fixed but not optimized--though generally that case is less of a good fit for the fill or responsive layout anyway.
2021-02-24 22:57:19 +00:00
JJ Kasper
d9bb645c03
Mention regex route behavior with i18n (#22500)
This mentions how locale routes are transformed when `locale: false` is not used to explain why regex routes might not match with i18n. 

Closes: https://github.com/vercel/next.js/issues/21507
2021-02-24 19:04:30 +00:00
JJ Kasper
b90b4b503c
v10.0.8-canary.8 2021-02-24 10:26:52 -06:00
Joe Haddad
775bdc341e
fix: correctly handle fallbacks for webpack 5 (#22497)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2021-02-24 10:25:57 -06:00
JJ Kasper
9d2b0fc04a
Ensure rewrites are resolved while prefetching (#22442)
This ensures we handle resolve rewrites during prefetching the same way we do during a client-transition. Previously if a rewritten source was used in an `href` neither the page bundle or SSG data if needed would be prefetched although would work correctly on a client transition. 


Fixes: https://github.com/vercel/next.js/issues/22441
2021-02-24 15:37:13 +00:00
Johan Eliasson
a78e904fc8
example: Nhost with auth and realtime graphql example added (#22493) 2021-02-24 14:18:05 +00:00
Lee Robinson
460c7c7ddc
Update deployment docs to mention caveat on next.config.js. (#22480) 2021-02-24 04:21:43 +00:00
Alex
e5bc0cdae0
docs(deployment): Update working directory in builder stage (#22478)
Update docker file example in deploy documentation to use correct working directory in builder stage. It will fail to copy files from that stage since it's attempting to copy files that don't exist.
2021-02-24 03:52:36 +00:00
Armando Magalhães
1253a11971
docs(deployment): Add Docker Image section (#17794)
Add a Docker Image section into the Deployment Documentation with an example and how to build and run it.

The example is a multi-stage docker image with node modules layer caching for faster builds in development and a result image just with the node_modules and build code needed to run the application within a custom user with restricted access.

The example contains a commented piece of code on how to disable telemetry as well.

This is useful for folks that are deploying to container orchestrators like ECS, Kubernetes (GKE, EKS, AKS) or Hashicorp Nomad, as well as just running a docker container in a single node in some cloud provider.
2021-02-24 00:42:15 +00:00
JJ Kasper
59d467542a v10.0.8-canary.7 2021-02-23 17:12:34 -06:00
JJ Kasper
5cf16ece71
Ensure static 500 hydrates correctly with query (#22468)
Follow-up to https://github.com/vercel/next.js/pull/22139 this ensures the default 500 error page hydrates with the correct `statusCode` prop when updating query values on the client since currently it will switch the 404 `statusCode` when one isn't present. An additional test case has been added to ensure this is handled correctly.
2021-02-23 22:15:46 +00:00
Joe Haddad
f8cd075870
chore: upgrade webpack5 (#22460)
Upgrades webpack 5 and watchpack to their latest versions.
2021-02-23 16:57:23 +00:00