Commit graph

13442 commits

Author SHA1 Message Date
Shu Uesugi
a746597430
chore(examples): Deprecate cms-strapi (#43325)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-11-24 12:01:10 +01:00
JJ Kasper
29a913467f
v13.0.6-canary.0 2022-11-23 19:16:49 -08:00
Ngô Đức Anh
f4610c31b0
Fix outputting un-necessary trace files for edge functions (#43304)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

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

## Feature

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

## Documentation / Examples

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

fixes #39275 and related issues like #39858 and hopefully #41395 (can't
test because `pnpm next-with-deps build ./dev-app` keeps crashing on
`Collecting page data...` - `useContext` seems to be null, and even
without the changes it still crashes).

This works by checking if the file is an edge function in Next.js's
Webpack plugin `TraceEntryPointsPlugin`, if true then output the nft
file to the output path, if not move up a folder like previously. I
tried changing Webpack config's output.path from `path: !dev &&
isNodeServer ? path.join(outputPath, 'chunks') : outputPath` to `path:
!dev && (isNodeServer || isEdgeServer) ? path.join(outputPath, 'chunks')
: outputPath`, but it just causes the build script to crash because
files like middleware-manifest.json are output to outputPath/chunks
instead of the expected outputPath. So I find this to be the better
solution.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-11-23 18:56:11 -08:00
Ngô Đức Anh
2eaa3ae146
fix appDir returning 404 in production with "output": "standalone" (#43268)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

Fixes: https://github.com/vercel/next.js/issues/42812
Fixes: https://github.com/vercel/next.js/issues/43037

## Bug

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

## Feature

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

## Documentation / Examples

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

This PR fixes the issue in which urls from appDir will always not be
found in production when built with `"output": "standalone"` by copying
.next/server/app and .next/server/app-paths-manifest.json into
.next/standalone/server.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-11-23 18:45:19 -08:00
Shu Ding
60d5c9615c
Improve RSC plugin to provide better errors (#42435)
This PR improves the RSC plugin for SWC to throw an error when the `"use
client"` directive is in the top level, but not before other statements
/ expressions. For example:

Code:

```js
import 'react'

'use client'
```

Error:

```
The "use client" directive must be placed before other expressions. Move it to the top of the file to resolve this issue.

   ,----
 3 | 'use client'
   : ^^^^^^^^^^^^
   `----
```

## Bug

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

## Feature

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

## Documentation / Examples

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-11-23 17:26:38 -08:00
Hannes Bornö
5788f602a4
Improve @next/font error handling (#43298)
Use `WellKnownErrorsPlugin` when formatting `@next/font` errors.

The error handling is different for expected errors (like validation
errors) and unknown ones. If the error is expected it just displays the
formatted error message. If it's an unknown error it will also display
the stacktrace, and in case the versions of `@next/font` and `next` are
different it will encourage you to try to update them both.

Removes the usage of `error-loader` when importing from
`pages/_document.js`, handle that case with `WellKnownErrorsPlugin` as
well.

The current warning when using different versions is removed. If the
versions are incompatible you'll get an error in the overlay instead.

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-23 16:08:28 -08:00
JJ Kasper
ec7609e288
Avoid turbo cache miss on root package change (#43309)
Since the `next-swc` package doesn't rely on any of the root
dependencies this normalizes the `package.json` to avoid cache misses
when the file changes.

x-ref:
https://github.com/vercel/next.js/actions/runs/3535337836/jobs/5933336967
x-ref:
https://github.com/vercel/next.js/actions/runs/3535337836/jobs/5933338363
x-ref: [slack
thread](https://vercel.slack.com/archives/C02HEJASXGD/p1669236151437999)
2022-11-23 15:32:35 -08:00
JJ Kasper
538c11021b
Ensure loaderFile is included in webpack cache key (#43315)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-23 15:31:31 -08:00
OJ Kwon
5d7e1425d7
test(integration): allow to run --turbo dev server tests dynamically (#42967)
This PR is companion to https://github.com/vercel/next.js/pull/42656.

Previous PR https://github.com/vercel/next.js/pull/41908 allowed to set up integration / e2e tests spawn `next dev` with `--turbo` as needed. This PR leverages those, change all the tests suites to run with `--turbo`. One additional change is it can be configured dynamically via env variable. Setting env `__INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH` to glob pattern will selectively enables tests to run with --turbo, normally it'll skip and only current devserver will be used.

These changes allow gradual integration between https://github.com/vercel/turbo to next.js. Plan is to run these tests with latest turbopack dev branch. Each time turbopack fixes / implements changes to enable certain set of tests, its CI will change its env variable without manually patching next.js's test cases. Once those change goes to upstream `next-swc` those tests can be permanantly enabled.

For those reasons, PR have somewhat verbose changes to touch individual test cases runs devserver. Changed file counts are lot, but mostly identical changes.

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-23 23:00:49 +00:00
JJ Kasper
f3a728bef1
v13.0.5 2022-11-23 14:00:15 -08:00
JJ Kasper
e079fbb10f
v13.0.5-canary.7 2022-11-23 12:09:15 -08:00
Balázs Orbán
aa51c26c2e
docs: add error link when missing appDir: true (#43293)
[Slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1669206360940399)

## Bug

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

## Feature

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

## Documentation / Examples

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2022-11-23 12:07:14 -08:00
Shu Ding
685c87c946
Show error for invalid page props in the TS plugin (#43300)
For page entries, currently it's only allowed to have `params` and
`searchParams` in props:

<img width="677" alt="CleanShot 2022-11-23 at 16 18 57@2x"
src="https://user-images.githubusercontent.com/3676859/203583323-12c24900-8046-4b3b-ac95-b0ed1bee37e4.png">

In the future, this will cover more cases for layout entries too.

## Bug

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

## Feature

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

## Documentation / Examples

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

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2022-11-23 19:27:06 +01:00
Shu Ding
2089af4535
Refactor code (#43291)
It seems that hot reloader's `start` method is only referenced in one
single place.

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-23 19:08:14 +01:00
Jiachi Liu
e581dc81dd
Resolve next api for layouts to esm for edge runtime (#43302)
The edge runtime should all use esm assets to keep the hooks and the react context are matched

Fixes: #43080

The issue is caused by the app router context and server inserted html context are not aligned. One side is using esm and other side is using the cjs asset.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
2022-11-23 18:01:16 +00:00
Jiachi Liu
e901feffc3
Update precompiled react (#43288)
Update pre-compiled react to fix the streaming issue with node 18.
x-ref: https://github.com/facebook/react/pull/25645

Fixes: #42466
Manually tested locally works for the reproduction from the issue

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
2022-11-23 15:57:38 +00:00
Laityned
369d6b76c4
Imageloader: collect images serverside to include images from staticp… (#41554)
In #41548, I show that I would like to provide an object with images in
getStaticProps. The StaticImageData is parsed correctly and provided as
a prop to the page. Nonetheless, the image is not available in the
static directory. Therefore the image is not shown. This is also
addressed in issue #29571. The underlying cause is that the import of
the image is removed from the client bundle and only present in the
server bundle.

Evaluating the next-image-loader shows that the file is only placed in
the static directory if emitted from the client bundle by firing
this.emitFile. By changing this to only emitting the file from the
serverside bundle in the webpackloader, static images loaded in the
getStaticProps are made available properly as well as images directly
used in componts (so present in server and client bundle).

This would PR would prevent the circumventing solution which enforces
that the StaticImageData should be present in the client side bundle
while it will also be present in the staticprops.

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

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


Closes #42783, Fixes #42443

Co-authored-by: Diederik <diederik@digitalpatrol.nl>
2022-11-23 09:28:53 -05:00
Mateusz Burzyński
33d4694ba7
Remove unused use-sync-external-store dependency (#43281)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-23 14:11:25 +01:00
Max Proske
093354c6d3
Convert with-videojs, with-yoga, with-zones examples to TypeScript (#43280) 2022-11-23 13:46:54 +01:00
Jan Kaifer
ee974817fe
Add support for next.js development in docker (#43138)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2022-11-23 11:35:49 +01:00
JJ Kasper
9fe5317417
v13.0.5-canary.6 2022-11-22 22:06:19 -08:00
Max Proske
8eb82b3891
Convert more jsx/styled-components examples to TypeScript (#43117)
Converted 3 more examples to TypeScript. Individual contributions pushed as separate commits.

## Documentation / Examples

- [X] Make sure the linting passes by running `pnpm build && pnpm lint`
- [X] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-23 05:45:26 +00:00
Balázs Orbán
3f30e26a3a
fix: apply default export interop to next/error (#43238)
Applies the same interop as we did for `next/jest` in #36824

We could potentially apply the same for other submodules, or do it on
the basis of someone hitting the issue.

Fixes #43206
## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-22 21:37:18 -08:00
Shu Ding
0caf8000e7
Add fallback aliases for React (#43203)
These aliases are needed by default (removed in
b0f87fbc7c)
because when transpiling external packages specified via `file:./` in
package.json, these external packages might not have `react` in their
dependencies and the package manager might not move or link them into
the current project's node_modules. In these cases, `react` can't be
resolved unless we alias it.

Related discussions can be found in
https://github.com/vercel/next.js/discussions/42136. This PR fixes the
test case
2f0b38197c/src/__tests__/__files__/pages/test-local-typescript-module.tsx.

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-22 21:32:53 -08:00
OJ Kwon
55232c2d0d
fix(next-swc): aarch64 build (#43275)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-22 21:02:01 -08:00
Jo Liss
b8c193bb58
docs: Add default browserslist configuration as a starting point (#43260)
This addition helps users figure out that this is the kind of expression they need to put in their `package.json`, and it provides the Next.js defaults to use as a starting point. (I was initially confused and thought the default configuration would just be "defaults".)

The list was pulled from `MODERN_BROWSERSLIST_TARGET` in [packages/next/shared/lib/constants.ts](28454c6ddb/packages/next/shared/lib/constants.ts (L56-L62)).



## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-23 02:29:43 +00:00
OJ Kwon
0d6e689e3d
build(cargo): bump up turbopack (#43273)
This PR bumps up turbopack to latest version.

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-23 02:22:14 +00:00
Tim Neutkens
28454c6ddb v13.0.5-canary.5 2022-11-22 19:56:20 +01:00
JJ Kasper
4239a669aa
Update flakey app HMR tests (#43253)
We shouldn't be using arbitrary `waitFor()` and instead should use our
`check` util for these tests.

follow-up to https://github.com/vercel/next.js/pull/43247
x-ref:
https://github.com/vercel/next.js/actions/runs/3525838483/jobs/5913081280
2022-11-22 10:54:44 -08:00
Tim Neutkens
fa5dcbd7fa
Fix React.cache() in layout/page file (#43187)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-11-22 19:49:51 +01:00
Balázs Orbán
274341373e
chore: add firebase-admin to default serverComponentsExternalPackages list (#43249)
Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-22 19:26:19 +01:00
JJ Kasper
20e9148fce
Update some flakey test cases (#43247)
x-ref:
https://github.com/vercel/next.js/actions/runs/3524646439/jobs/5910393352
x-ref:
https://github.com/vercel/next.js/actions/runs/3524098862/jobs/5909115848
2022-11-22 09:50:03 -08:00
Jan Kaifer
a2df178554
Add links to PR template (#43239) 2022-11-22 16:12:35 +01:00
ADTC
4196822b9c
Add a note about the auto-created empty directory (#43219)
It isn't clear whether the `create` step needs to be run inside an empty directory (avoiding conflicts with existing content in the current working directory), or whether it can be run in a directory with existing contents, and its output would be placed in an empty directory automatically created from the project name.



## Bug

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

## Feature

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

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-22 14:11:55 +00:00
Shu Ding
3a770fd143
Fix app routes are not correctly matched when src directory is used (#43234)
When creating the client entries, the `src/` prefix shouldn't be included in the entrypoint's name. Closes #42874.

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-22 14:03:46 +00:00
Artur Bień
ef7a6e1210
docs: add missing AppProps import (#43136) 2022-11-22 14:33:29 +01:00
Rishabh Poddar
08ee7b22ec
Updates supertokens example app SSR behaviour (#43218)
Co-authored-by: Rishabh <rishabh@supertokens.io>
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-11-22 14:32:49 +01:00
FomichRoman
807c59a215
chore(examples): update Next.js in with-redux-reducer (#43237)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-11-22 14:28:07 +01:00
Balázs Orbán
7596132a0c
fix(ts): re-export PageComponent and LayoutComponent types (#43226) 2022-11-22 13:49:01 +01:00
Mateus Etto
3a2af8fb0b
Fix With Passport example (#43232) 2022-11-22 13:45:19 +01:00
Andy Kenward
f400adf5e9
chore(examples): with-msw update msw (#43224)
CLOSES https://github.com/vercel/next.js/issues/43221
2022-11-22 11:33:44 +01:00
JJ Kasper
7ae1cb8e8d
v13.0.5-canary.4 2022-11-21 17:03:50 -08:00
Julius Marminge
9f93d34061
fix: create-next-app copies files it shouldn't (#43131)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

Closes #43130

This fixes the bug where the CLI copies files it shouldn't, by adding a
`/` separator at the end of the directory name.

Given `examples/next-prisma-starter` and
`examples/next-prisma-starter-websockets`, only files inside the
`examples/next-prisma-starter` will now be copied.

Here is a repo created by the CLI after this fix, using

```bash
# Inside packages/create-next-app
pnpm build
node dist/index.js --example https://github.com/trpc/trpc --example-path examples/next-prisma-starter
```

https://github.com/juliusmarminge/create-next-app-bugfix

## Bug

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

## Feature

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

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-21 16:51:57 -08:00
Colin
ed2aa9fd75
Fix HMR error: "Cannot read properties of null (reading 'length')" (#43145)
After upgrading to Next.js 13, we started seeing the following HMR
errors:

```sh
$ next dev
# ...
warn  - Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/basic-features/fast-refresh#how-it-works
TypeError: Cannot read properties of null (reading 'length')
    at eval (webpack-internal:///./node_modules/next/dist/client/dev/error-overlay/hot-dev-client.js:262:55)
```

This error appears related to the changes made in
https://github.com/vercel/next.js/pull/42350 (cc @alexkirsz). It appears
that `module.hot.check` will pass `null` when there are no updates:

```ts
  /**
   * Throws an exceptions if status() is not idle.
   * Check all currently loaded modules for updates and apply updates if found.
   * If no update was found, the callback is called with null.
   * If autoApply is truthy the callback will be called with all modules that were disposed.
   * apply() is automatically called with autoApply as options parameter.
   * If autoApply is not set the callback will be called with all modules that will be disposed on apply().
   * @param autoApply
   */
  check(autoApply?: boolean): Promise<null|ModuleId[]>;
```

When `updatedModules` is `null`, we skip the `apply()` call as this was
producing `apply() is only allowed in ready status (state: idle)`
errors. This matches [the prior behavior when `autoApply` was
enabled](8241da7f1e/lib/hmr/HotModuleReplacement.runtime.js (L266-L272)).

Fixes #43143. Also reported on Stack Overflow: 
-
https://stackoverflow.com/questions/74415937/nextjs-typeerror-cannot-read-properties-of-null-reading-length
-
https://stackoverflow.com/questions/74504229/nextjs-v-13-typeerror-cannot-read-properties-of-null-reading-length

I tested this change locally and no longer see these HMR errors.

## Bug

- [X] Related issues linked using `fixes #number` - no related issues
- [X] Integration tests added - there aren't any existing tests, afaict
- [X] Errors have a helpful link attached, see `contributing.md` - N/A

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-11-21 16:50:03 -08:00
Hannes Bornö
d8d9b2c985
Remove app routes from _devPagesManifest (#43188)
Currently in dev the `_devPagesManifest` includes the `/app` routes as
well. However, In production, the `_buildManifest.js` does not include
the `/app` routes. This causes the `/pages` router to behave differently
in the two environments.

This change excludes the `/app` routes from `_devPagesManifest` to make
it work the same in dev/prod.

Fixes #42513
Fixes #42532

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-11-21 15:52:12 -08:00
Jiachi Liu
ee969ea8fc
Fix middleware not executed when pages directory is empty (#43205)
Fixes #41995

Closes #43144

## Bug

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

Co-authored-by: Bruno Nascimento <bruno.hn@icloud.com>
2022-11-21 15:37:58 -08:00
JJ Kasper
5d39daaf1c
Update tests config (#43204)
Testing if this reduces flakiness we've been seeing
2022-11-21 14:39:47 -08:00
Jiachi Liu
869039529c
Alias esm next document to avoid mismatch react context (#43192)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

When using custom document and importing from `next/document`,
`HtmlContext` instance will mismatch due to CJS version of
`next/document` is consumed. Gotta alias it to the ESM version for edge
runtime

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-11-21 14:15:55 -08:00
Jiachi Liu
2763f60806
Avoid bundling appDir rendering into pages edge SSR bundle (#43184)
Do not directly import app-render into base-server since base-server is
shared module for both nodejs SSR and edge SSR.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-21 14:09:46 -08:00
JJ Kasper
c1370c923e
Update experimental skipTrailingSlashRedirect handling (#43201)
Fixes: [slack
thread](https://vercel.slack.com/archives/C01224Q5M99/p1669029502713689?thread_ts=1668452468.314249&cid=C01224Q5M99)

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`
2022-11-21 13:25:01 -08:00