Commit graph

593 commits

Author SHA1 Message Date
JJ Kasper
434a8cb7d0
Fix missing hasHeader mock during revalidate (#45681)
Replaces usage of `hasHeader` of `getHeader` and also ensures we include
`hasHeader` in our `mockRes` we create during revalidate for good
measure.

## 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)

Closes: https://github.com/vercel/next.js/issues/34929
Closes: https://github.com/vercel/next.js/issues/37338
Closes: https://github.com/vercel/next.js/issues/45481
2023-02-07 17:51:26 -08:00
Jiachi Liu
e36fb42e30
Add warning for head.js with metadata docs link (#45680)
Warn users when there's `head.js` being used in `app/`, and recommend to
use metadata. Will show a warning in console while rendering

Closes NEXT-268

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Lee Robinson <me@leerob.io>
2023-02-07 17:02:40 -08:00
JJ Kasper
01649d93ab
Skip prefetching for bots in app-router too (#45678)
Same as https://github.com/vercel/next.js/pull/40435 this ensures we
don't prefetch for bots in `app-router` as well.

Fixes: https://github.com/vercel/next.js/issues/45677

## 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)
2023-02-07 14:15:10 -08:00
Jiachi Liu
c26fc2456b
Picking apple-icon instead of apple-touch-icon (#45673)
Fix up a icon convention in #45612, we should pick up the
`apple-icon.<ext>` as this is a shorter path for users to remember.

Also addessing some feedbacks from @shuding in #45612

---------
2023-02-07 13:25:39 -08:00
Jiachi Liu
25dfdbb131
Support filebased metadata icon and apple touch icons (#45612)
This PR add supports for a shortcut for adding `icons.icon` or
`icons.apple` metadata for page or layout with static files.

Closes NEXT-263
Closes NEXT-260

If you specific icon.png or apple-touch-icon.png, they will be
automatically picked by and added into metadata as `icon` and
`apple-touch-icon` fields, and replace the `icons` field specified in
page/layout level metadata exports.

File matching rule:
```
icon -> /^icon\d?\.(ico|jpg|png|svg)$/
apple-touch-icon -> /^apple-touch-icon\d?\.(ico|jpg|png|svg)$/
```

## 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`
- [x]
[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)

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-02-07 18:30:59 +01:00
Jan Kaifer
3827d8fbfb
Fix issue where layout-router wouldn't auto-scroll if we imported styles or fonts (#45487)
fixes https://github.com/vercel/next.js/issues/42492
2023-02-07 12:03:18 +00:00
Tim Neutkens
30a6c51296
Refactor server-patch-reducer and refresh-reducer to use applyFlightData and handleMutable (#45608)Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Jan Kaifer <jan@kaifer.cz>
Follow-up to #45555. This uses the same handling of mutable for
serverPatchReducer and refreshReducer.

Fixes NEXT-213

Ensures scroll position is still applied when calling `router.push()`
and `router.refresh()` in a single transition:
```tsx
startTransition(() => {
    router.push('/dashboard')
    router.refresh()
})
```
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
-->

## 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: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jan Kaifer <jan@kaifer.cz>
2023-02-06 14:53:34 +01:00
Jiachi Liu
a2dc530f44
Separate next/dynamic implementation for app and pages (#45565)
## Issue

To address the problem that we introduced in 13.0.7 (#42589) where we thought we could use same implementation `next/dynamic` for both `pages/` and `app/` directory. But it turns out it leads to many problems, such as:

* SSR preloading could miss the content, especially with nested dynamic calls
  * Closes #45213
* Introducing suspense boundary into `next/dynamic` with extra wrapped `<Suspense>` outside will lead to content is not resolevd during SSR
  * Related #45151
  * Closes #45099
* Unexpected hydration errors for suspense boundaries. Though react removed this error but the 18.3 is not out yet.
  * Closes #44083
  * Closes #45246
 
## Solution

Separate the dynamic implementation for `app/` dir and `pages/`. 

For `app/` dir we can encourage users to: 
  * Directly use `React.lazy` + `Suspense` for SSR'd content, and `next/dynamic` 
  * For non SSR components since it requires some internal integeration with next.js.

For `pages/` dir we still keep the original implementation

If you want to use `<Suspense>` with dynamic `fallback` value, use `React.lazy` + `Suspense` directly instead of picking up `next/dynamic` 
  * Closes #45116

This will solve various issue before react 18.3 is out and let users still progressively upgrade to new versions of next.js.

## Bug Fix

- [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)
2023-02-04 01:45:35 +00:00
Sam Ko
a85c636bfe
Fix middleware matcher for i18n with negative look ahead (#45504)closes https://github.com/vercel/next.js/issues/40305
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
-->

Found a bug with excluding `/_next/static` from Edge Middleware due to
`/_next` being special-cased when deployed and i18n is configured.

```
export const config = {
  matcher: [
    '/',
    '/((?!api|_next/static|favicon|.well-known|auth|sitemap|robots.txt|files).*)',
  ],
};
```

closes: https://github.com/vercel/next.js/issues/40305

## 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)
2023-02-01 17:30:48 -08:00
Jiachi Liu
c5f1b45923
Fix metadata alternate and refactor twitter item (#45480)
x-ref: https://github.com/vercel/next.js/discussions/41745#discussioncomment-4827270

refactor twitter related items based on @gnoff 's feedback

## 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)
2023-02-01 13:43:12 +00:00
Jiachi Liu
a1c04b0162
Support generateMetadata export (#45401)Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Closes NEXT-397

Resolve `metadata` and `generateMetadata()` exports along with head
during rendering, this is the easy way for now to collect all the
metadata properly. Since we can access segment params and search params
only in rendering, so I moved all the resolving logic from loader to
render process.

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


## 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`
- [x]
[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)

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-02-01 12:54:39 +01:00
Jan Kaifer
659a75177b
Update error message for dynamic = "error" (#45432)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-02-01 11:20:35 +00:00
Hannes Bornö
e8fcf8b569
Add data attributes on @next/font usage (#45296)
Adds `data-next-font` data attribute to the preload tag if added by
`@next/font`.
```js
// Using `size-adjust` fallback font.
<link data-next-font="size-adjust" rel="preload" href="..." as="font" type="font/woff2" crossorigin="anonymous">

// Not using `size-adjust` fallback font.
<link data-next-font="" rel="preload" href="..." as="font" type="font/woff2" crossorigin="anonymous">
```

If no fonts are preloaded, the tag is added on the preconnect tag.

Fixes NEXT-350

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-01-31 14:16:13 -08:00
Shu Ding
326485c06e
Export the Metadata type (#45445)
This allows people to manually type their exported `metadata` field:

<img width="610" alt="CleanShot 2023-01-31 at 15 43 00@2x"
src="https://user-images.githubusercontent.com/3676859/215792182-8d9cf72a-dedf-4cc9-8613-d4eb49501abc.png">

## Bug

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

## Feature

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

## Documentation / Examples

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

---------
2023-01-31 10:49:07 -08:00
Tim Neutkens
78c5be4e32
Add support for navigating to external urls (#45388)
Adds support for `router.push('https://google.com')`,
`router.replace('https://google.com')`, and
`redirect('https://google.com')`.

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

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-01-31 19:39:36 +01:00
Hannes Bornö
eef157f9df
@next/font change default font-display (#45430)
Change default font-display from `optional` to `swap`.

[slack
ref](https://vercel.slack.com/archives/C03KED0D4N7/p1674949620477649)

Fixes NEXT-430

## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-01-31 08:26:38 -08:00
Jiachi Liu
41e2613aca
Update robots meta and add verification rendering (#45409)
Follow up for: #45237

* Adding more fields for robots meta, most related to googlebot
* Add `me` and `yandex` field and render for verification field
2023-01-30 20:49:30 +00:00
JJ Kasper
d3a9f5a54a
Fix trailing slash redirect applying for data request (#45417)
This ensures we don't apply the trailing slash redirect for `_next/data`
requests as it can cause props to fail to resolve on client transition.
This also fixes `missing` fields not being applied correctly for
`headers` and `redirects` as the field wasn't being passed through.

## 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)

Closes: https://github.com/vercel/next.js/pull/45398
Fixes: https://github.com/vercel/next.js/issues/45393
x-ref: https://github.com/vercel/next.js/issues/45340
2023-01-30 12:10:30 -08:00
JJ Kasper
c7deecfd29
Fix flakey app metadata test (#45391)
We shouldn't use an arbitrary timeout here.

x-ref:
https://github.com/vercel/next.js/actions/runs/4038320521/jobs/6942258801
2023-01-29 20:57:23 -08:00
JJ Kasper
bcd63af2c9
Fix fetch stack test on deploy 2023-01-27 18:23:27 -08:00
JJ Kasper
1404eedf79
Update flakey app prefetch test (#45361)
x-ref:
https://github.com/vercel/next.js/actions/runs/4028868244/jobs/6926255942
2023-01-27 16:18:27 -08:00
Jiachi Liu
9822f78f1f
Resolve metadata fields (#45237)
## 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`
- [x]
[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)
2023-01-27 12:57:48 +01:00
JJ Kasper
eed2086cc6
Update flakey fetch stack test (#45318)
x-ref:
https://github.com/vercel/next.js/actions/runs/4017855404/jobs/6902831642

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-01-26 12:55:15 -08:00
Gal Schlezinger
35f68bc691
[edge] improve fetch stack traces in edge runtime (#44750)
Right now, when doing the following in an Edge API:

```typescript
export default async () => {
  await fetch("https://hello.world");
};
```

The stack trace generated does not contain the actual line of code that caused the error.
This gives a bad developer experience when working with `next dev`.
This PR fixes that for this specific use case and adds a test to make sure there's no regression.

For `next start`, there's also a small change, that needs to be pushed upstream to `edge-runtime`.
In order to run user code in the Edge Runtime, we call `vm.evaluate(code: string)`. However,
if we embrace the `options` from the signature of `vm.runInContext(code, ctx, options)`, we can
pass in the filename so the stack trace is correct.

## Bug

- [ ] 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)
2023-01-26 10:16:53 +00:00
JJ Kasper
8f05c0c07e
Update flakey test cases (#45290) 2023-01-25 22:55:49 -08:00
JJ Kasper
e868f77ede
Update app cache handling in development (#45248) 2023-01-25 11:51:53 -08:00
Hannes Bornö
018208fb15
Add editor links to RSC build error (#45179) 2023-01-24 15:13:37 -08:00
Jiachi Liu
45a9373113
Support metadata icons field (#45105)
NEXT-400

## 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`
- [x] [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)
2023-01-24 18:19:11 +00:00
Jan Kaifer
b386f680cc
Update handling of autoscrolling on navigation in app (#43845)
- Add support for scrolling to the sides and down when navigating
- Add tests for vertical scrolling
- Add tests for horizontal scrolling
- Add tests for `router.refresh()`
	- should not scroll by itself
	- should not block router.push from scrolling
	- should not scroll when page refreshed using fash refresh
- Scroll to the top of document if that gets page into viewport
	- I didn't want to implement some heuristics on if we can scroll to the top of the page so I just scroll there and check.
	- This implementation may not play well with some nested scrollable containers (but that never worked, just FYI)
	
- Improved typings on `BrowserInterface` a little - backward compatible change.

Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
2023-01-24 15:41:06 +00:00
JJ Kasper
2e251cb85f
Revert "Revert "Revert "Revert "Initial support for metadata (#44729)"" (#45113)"" (#45196)
Hopefully last time

Reverts vercel/next.js#45130
2023-01-24 13:21:59 +00:00
Hannes Bornö
6b5f5d2f9f
Add build time error if error.js is missing "use client" (#44961) 2023-01-24 09:57:40 +01:00
Jiachi Liu
e33e46d950
Fix dynamic no ssr with babel transform (#45091) 2023-01-23 13:39:47 -08:00
JJ Kasper
f931a636e1
Add debug info to static bailout message (#45192) 2023-01-23 13:25:00 -08:00
JJ Kasper
440560fbbb
Ensure config warnings only show once (#45142)
Since we now call `loadConfig()` in various processes our `execOnce`
handling isn't tracking when we have already shown warnings/logs in
another process so this adds a `silent` flag that we can leverage when
calling `loadConfig()`.

## 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)

Fixes: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1674351677627259)
2023-01-21 22:47:24 -08:00
Maia Teegarden
b224c5f3ee
Revert "Revert "Revert "Initial support for metadata (#44729)"" (#45113)" (#45130)
This reverts commit 259cbc1806.

It does not have necessary changes to make Turbopack work.



## Bug

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

## Feature

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

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-01-21 19:22:56 +00:00
JJ Kasper
259cbc1806
Revert "Revert "Initial support for metadata (#44729)"" (#45113) 2023-01-20 15:34:50 -08:00
JJ Kasper
e0865b10e0
Revert "Initial support for metadata (#44729)" (#45111) 2023-01-20 11:57:18 -08:00
Damien Simonin Feugas
e8ae4e219e
fix(#44077): allow edge runtime for api routes inside src/ folder (#45093)
fixes: https://github.com/vercel/next.js/issues/44382
closes: https://github.com/vercel/next.js/pull/44882
closes: https://github.com/vercel/next.js/pull/44383
2023-01-20 11:04:27 -08:00
JJ Kasper
dc119e20ba
Fix metadata e2e test on deploy (#45104) 2023-01-20 09:22:07 -08:00
Shu Ding
d1f6a4295b
Initial support for metadata (#44729)
This PR implements page and layout exported `metadata` field support with limited properties.

## 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] [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)


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2023-01-20 08:47:30 +00:00
Jiachi Liu
c648f9d413
Fix next/dynamic non ssr in pages when appDir is enabled (#45066)
When `appDir` is enabled, `next/dynamic` with `ssr: false` didn't get
correctly compiled with swc. The `server_components` condition in
next_dynamic transform should respect to the server components
compilation, but it was accidently turned on when server components is
enabled.

This PR fixes it that only turn on the flag when it's in server
components compilation (when `is_server` option is `true`)

reported by @MaxLeiter 

## 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)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-01-20 00:25:46 +01:00
Rinku Chaudhari
a4d9373bd0
Remove useless ts-ignores (#45025) 2023-01-18 19:37:44 -08:00
JJ Kasper
4dfe831bbb
Add project directory rename/remove handling (#44911) 2023-01-18 14:37:40 -08:00
JJ Kasper
ad48202432
Ensure force-dynamic is honored during build (#45015) 2023-01-18 11:24:48 -08:00
JJ Kasper
6b7c69fa4d
Add proper error when app path switches static to dynamic (#44989) 2023-01-18 10:24:35 -08:00
JJ Kasper
8f0acdf781
Gracefully handle telemetry not being available (#44986) 2023-01-17 16:00:22 -08:00
Shu Ding
3a9bfe60d2
Fix CSS imports being tracked multiple times (#44938)
Currently the way our renderer injects CSS is to first track CSS imports on the module level, and then render these links on each layer. However, in a complex application it's possible that one CSS being imported in many modules, and in multiple layouts. This causes an issue of duplication. And if there are many rules the order could be messed up by that. 

This PR deduplicates CSS resources used by one entry (layout, page, error, ...) and all its parent layouts. If an entry is rendered, all its ancestors are rendered too.

See test case for more details. Currently those two tests will all fail.

Fixes #42862.

## Bug

- [ ] 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)
2023-01-17 18:36:00 +00:00
JJ Kasper
28bf703285
Update test env for E2E deploy mode (#44937) 2023-01-16 15:39:54 -08:00
JJ Kasper
d5a188de06
Update test env variable passing (#44912) 2023-01-15 23:20:16 -08:00
Jiachi Liu
375871620a
Handle empty module from the next dynamic loader (#44873) 2023-01-13 16:48:29 -08:00