Commit graph

432 commits

Author SHA1 Message Date
Tobias Koppers
129f56d3e7
more turbopack HMR fixes and test case (#55368)
### What?

improve test case to check HMR
reenable deduplication for server side hmr events
add aggregation of client side HMR events

### Turbopack Changes

* https://github.com/vercel/turbo/pull/5936 <!-- Will Binns-Smith -
Update http mock and clap -->
* https://github.com/vercel/turbo/pull/5948 <!-- Tobias Koppers - CSS
HMR fixes -->



Closes WEB-1557

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-14 15:50:59 +02:00
Tobias Koppers
9953db4a30
Revert "feat(turbopack): support next.js specific node polyfills" (#55385)
Reverts vercel/next.js#55343

Closes WEB-1562

it fails CI with:

```
  ● node builtins › should support node.js builtins in server component
  
      SyntaxError: Unexpected end of JSON input
          at JSON.parse (<anonymous>)
  
        124 |
        125 |       const data = $('#node-browser-polyfills').text()
      > 126 |       const parsedData = JSON.parse(data)
            |                               ^
        127 |
        128 |       expect(parsedData.vm).toBe(105)
        129 |       expect(parsedData.hash).toBe(
  
        at Object.<anonymous> (development/basic/node-builtins.test.ts:126:31)
  
    ● node builtins › should support node.js builtins prefixed by node: in server component
  
      SyntaxError: Unexpected end of JSON input
          at JSON.parse (<anonymous>)
  
        149 |
        150 |       const data = $('#node-browser-polyfills').text()
      > 151 |       const parsedData = JSON.parse(data)
            |                               ^
        152 |
        153 |       expect(parsedData.vm).toBe(105)
        154 |       expect(parsedData.hash).toBe(
  
        at Object.<anonymous> (development/basic/node-builtins.test.ts:151:31)
  
  ```
  
  @kwonoj
2023-09-14 15:16:33 +02:00
OJ Kwon
e8adcd8527
feat(turbopack): support next.js specific node polyfills (#55343)
- feat(turbopack): support next.js specific node polyfills
- test(turbopack): migrate polyfill tests

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

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

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

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

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


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change



### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?

This PR fulfills gap for the node.js polyfill between next.js to
turbopack, then enable corresponding integration tests.


Closes WEB-1552
2023-09-14 14:52:16 +02:00
Jiachi Liu
14e94e69c5
fix duplicated error logging when start server (#55328)
There're few places calling `loadConfig` to access nextjs config for different purpose, and every of them will do validation of next config scheme and could log the warnings potentially to cause duplicated warnings. To address that issue this PR limit the places when should the warnings be logged in certain places, mainly the `next` command entry. Refactor the API here to make it more explicit

Previous logging redeisgn also might trigger duplicated compilation, for instance you compiled page A but then editing another component it might still displaying page A is recompiled. Now we always display `"Compiled .."` message when there's a recompilation but avoid the unnecessary ones such as initial edge compilor ready but there's no modules inside. Then when it recompiles or recovers from error nextjs server will tell "Compiled .." instead of the specific page which might be not related.

Also refactors a minor issue: When `silent` option is set to `true`, auto recorrect next config option from `loadConfig` API like `traillingSlash` is not working

Closes NEXT-1610

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-09-13 22:25:41 +00:00
Michael Novotny
fe797c1074
Updates Mozilla links to not include language preference (#55326)
Internal suggestion to remove `en-US` from Mozilla urls since MDN is
available in multiple languages nowadays it will automatically redirect
to the viewer’s language preference.

Closes
[DX-2076](https://linear.app/vercel/issue/DX-2076/make-external-mozilla-links-language-agnostic-in-nextjs-docs)
2023-09-13 11:06:29 -05:00
Jiachi Liu
083f49c247
Logging improvements (#55298)
## Logging Improvements

* Delay server start logging
Post start logging after request handler is created, so when error
occurred like missing "app" or "pages" directory it won't log start
server message, instead it will only show error message.

* Fix jsconfig hmr case
Previously the `jsconfig.json` is patched too early that didn't trigger
the hmr reload, this PR enables it to show on the

* Adding timestamp for "ready" event
Display a timesmap after "ready" message, so we can monitor how long
does it take, and keep perfing on it

* Polish logging format
  * Starts with captital letter
  * align the indentation


![image](https://github.com/vercel/next.js/assets/4800338/fb87e0c4-3965-48da-86ef-a178e77d83f2)
2023-09-13 15:27:02 +02:00
JJ Kasper
7d93808c43
Remove render workers in favor of esm loader (#54813)
Currently we create separate workers to isolate `pages` and `app`
routers due to differing react versions being used between the two. This
adds overhead and complexity in the rendering process which we can avoid
by leveraging an `esm-loader` similar to our `require-hook` to properly
alias `pages` router to the bundled react version to match `app` router
when both are leveraged together.

This aims to seamlessly inject the `esm-loader` by restarting the
process with the loader arg added whenever `next` is imported so that
this also works with custom-servers and fixes the issue with custom
req/res fields not working after upgrading.


x-ref: https://github.com/vercel/next.js/issues/53883
x-ref: https://github.com/vercel/next.js/issues/54288
x-ref: https://github.com/vercel/next.js/issues/54129
x-ref: https://github.com/vercel/next.js/issues/54435
closes: https://github.com/vercel/next.js/issues/54440
closes: https://github.com/vercel/next.js/issues/52702
x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1693348443932499?thread_ts=1693275196.347509&cid=C03KAR5DCKC)

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-09-11 22:17:52 +02:00
OJ Kwon
360142d409
tests(next-dev): migrate basic tailwind tests for turbopack (#55118)
Closes WEB-1518

### What?

This PR refactors test cases from next-dev, tests basic tailwind rendering with turbopack. It still runs against plain next.js too. While checking, noticed there's a stub fixture (css-fixture/with-tailwindcss) but those fixture seems not being used in the test. Moved those and utilized. Since this test runs against next.js / turbopack both anyway, moving fixture should not be a huge regression I believe.
2023-09-11 15:44:39 +00:00
Leah
6e3ef5b01c
feat: support expanding urls in nexturbo (and fix static files) (#55147)
Closes WEB-1525
2023-09-08 21:35:33 +00:00
Tobias Koppers
15980a66d4
remove --turbo, use --experimental-turbo as --turbo (#55063)
### What?

Switch the default for `--turbo` to the new `--experimental-turbo`, remove the old code in next.js

### Why?

The new approach will be used in future


Closes WEB-1506
2023-09-06 17:46:54 +00:00
Jiachi Liu
e117c000e4
Redesign nextjs logging (#54713)
The current logging styles has been existed for a while, this PR gives a fresh impression for the logging output from Next.js.
We want to achieve few new goals that makes the output clean, modernized, sweet 🍫 .

Few goals are addressed with this redesign:

## Refresh Impression & Simplification

The new design of logging is much more information centralized and streamlined.

* Given a `ready` message at the begining when compilers are bootstrapped.
* Only show `compiled` event with green check mark indicating succesful compilation, this will merge the unclear `compiling` event which shows `(client and server)` before, now tell you the route compilation info in one line.

hello world app

### `next dev`

#### After vs Before


<img src="https://github.com/vercel/next.js/assets/4800338/9649b340-8241-4756-a2b3-a989f0b74003" height="120"> 
<img src="https://github.com/vercel/next.js/assets/4800338/ee181263-3dd4-40d0-9ffc-819a56b45900" height="120">  

 


 

### `next build`

#### After vs Before


<img src="https://github.com/vercel/next.js/assets/4800338/5db9829a-9ffc-49f0-b030-93ee92f5c248" width="360"> 
<img src="https://github.com/vercel/next.js/assets/4800338/b9527b83-27c8-4426-9c0d-c0d4072b7d58" width="360">





### error status

#### After vs Before

<img src="https://github.com/vercel/next.js/assets/4800338/00455226-ace7-468b-8d90-0d36bf038489" height="120"> 
<img src="https://github.com/vercel/next.js/assets/4800338/1be8c451-d3f0-465c-9ef7-6b0dde7cff85" height="120"> 



## Streamlization

If you have customized envs and experiments Next.js will give the brief in the early summary about your network information, env vars, and enabled experimental features

<img src="https://github.com/vercel/next.js/assets/4800338/ca1a7409-1532-46cb-850f-687e61e587b2" width="400">


## Polish

### fetching logging structure 

#### After vs Before
<img src="https://github.com/vercel/next.js/assets/4800338/97526397-dffe-4736-88ed-e5cbe5e945bd" width="400">
<img src="https://github.com/vercel/next.js/assets/4800338/ab77c907-5ab5-48bb-8347-6146d2e60932" width="400">


### Dedupe Duplicates

The logging is moved from `@next/env` to `next` itself, `@next/env` will only notify the invoker that the env is reloaded. Then the duplicated logs for the env reloading cases can be avoid.

#### After vs Before
<img src="https://github.com/vercel/next.js/assets/4800338/04799295-e739-4035-87aa-61cec962fc39" width="400">
<img src="https://github.com/vercel/next.js/assets/4800338/e29020c9-0031-4bf3-a21b-8b64633f43a2" width="400"> 


### Different indicators

Use unicode text icons for different situation: 
* passed -> check mark
* warning -> warning
* error -> red cross
* loading -> circle

<img src="https://github.com/vercel/next.js/assets/4800338/715c34bd-298f-4990-a5d7-e12e455ead44" width="400">



Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
2023-09-05 11:40:00 +00:00
Tim Neutkens
f313235428
Remove pong HMR event as it is not used (#54965)
While investigating the HMR event types I noticed `pong` is not being used in Pages Router nor in App Router.

This PR removes the code that sends it as it's essentially dead code.
2023-09-04 13:27:47 +00:00
Shu Ding
ef6140723a
Ensure that barrel files behind wildcards are transformed into shortpath (#54951)
This fix ensures the case that if you `import { foo } from './index'`,
where:

index.js:

```js
export * from './subpkg'
```

subpkg.js:

```js

const unrelatedExpressions = ...

export { foo } from './foo'
export { bar } from './bar'
```

Previously we'll transform the proxy to the second module to `export {
foo } from './subpkg'`. With this fix it will be correctly optimized as
`export { foo } from './foo'` which is a shorter path.
2023-09-03 13:02:14 -07:00
Zack Tanner
37fda7f2a4
fix hmr test flake (#54890)
This should hopefully fix this test flake by checking the logs only after the page has been rendered & an initial log is received

x-ref: https://github.com/vercel/next.js/actions/runs/6050063024/job/16418585779?pr=54889#step:29:3102
2023-09-01 15:16:22 +00:00
Shu Ding
f567aaf11e
Add @visx/visx to the import optimization list (#54778)
Ref: https://unpkg.com/@visx/visx@3.3.0/lib/index.js.
2023-08-30 15:11:03 +00:00
Jiachi Liu
ba0472c507
Fix unexpected full hmr reload when editing _app (#54690)
### What
When you only have `pages/` folder and custom `_app.js`, editing the
`_app.js` file when unexpectedly lead to full page reload. This is
because the `pages/_app` chunk is included into `pages/_document` chunk
as they all pass through the `next-route-loader` which forms the router
module and other userland modules including `/_app` and `/_document`.
That leads to a change: whenever you modify `_app.js`, chunk hash of
`/_document` will always be updated as it's built as a new chunk.

Found this difference by looking at the document chunk with nextjs in
early 13.4.x releases.

### How

We'll check at the entries creation point to filter out `/_app` and
`/_document` so that we won't have them both bundled for `_document`
chunk. Then when we won't trigger the hmr path to reload the page since
_document chunk hash is updated.

Closes NEXT-1568
Fixes #53614
2023-08-30 12:44:08 +02:00
Shu Ding
70d41b2627
Improve barrel optimizer with loader caching and wilcard exports (#54695)
## Initial Pass

The initial pass applies to all user code. If an import (`foo`) matches one of the packages from our list, say:

```js
// user code

import { a } from 'foo'
import { otherThings } from './code'
```

The initial pass transforms it into:

```js
// user code

import { a } from '__barrel_optimize__?names=a!=!foo'
import { otherThings } from './code'
```

## Barrel Optimizations

This `__barrel_optimize__` loader is used to optimize the imports of "barrel" files that have many
re-exports. Currently, both Node.js and Webpack have to enter all of these
submodules even if we only need a few of them.

For example, say a file `foo.js` with the following contents:

```js
  export { a } from './a'
  export { b } from './b'
  export { c } from './c'
  ...
```

If the user imports `a` only, this loader will accept the `names` option to
be `['a']`. Then, it request the `__barrel_transform__` SWC loader to load
`foo.js` (via `this.loadModule` Webpack API) and receive the following info:

```js
  export const __next_private_export_map__ = '[["./a","a","a"],["./b","b","b"],["./c","c","c"],...]'
```

The export map, generated by SWC, is a JSON that represents the exports of
that module, their original file, and their original name (since you can do
`export { a as b }`).

Then, this loader can safely remove all the exports that are not needed and
re-export the ones from `names`:

```js
  export { a } from './a'
```

That's the basic situation and also the happy path.



## Wildcard Exports

For wildcard exports (e.g. `export * from './a'`), it becomes a bit more complicated.
Say `foo.js` with the following contents:

```js
  export * from './a'
  export * from './b'
  export * from './c'
  ...
```

If the user imports `bar` from it, SWC can never know which files are going to be
exporting `bar`. So, we have to keep all the wildcard exports and do the same
process recursively. This loader will return the following output:

```js
  export * from '__barrel_optimize__?names=bar&wildcard!=!./a'
  export * from '__barrel_optimize__?names=bar&wildcard!=!./b'
  export * from '__barrel_optimize__?names=bar&wildcard!=!./c'
  ...
```

The "!=!" tells Webpack to use the same loader to process './a', './b', and './c'.
After the recursive process, the "inner loaders" will either return an empty string
or:

```js
  export * from './target'
```

Where `target` is the file that exports `bar`.



## Non-Barrel Files

If the file is not a barrel, we can't apply any optimizations. That's because
we can't easily remove things from the file. For example, say `foo.js` with:

```js
  const v = 1
  export function b () {
    return v
  }
```

If the user imports `b` only, we can't remove the `const v = 1` even though
the file is side-effect free. In these caes, this loader will simply re-export
`foo.js`:

```js
  export * from './foo'
```

Besides these cases, this loader also carefully handles the module cache so
SWC won't analyze the same file twice, and no instance of the same file will
be accidentally created as different instances.

---

- [x] Disable this loader for Jest
- [x] Add tests for SWC loader caching
- [x] Add tests for external modules
- [x] Add tests for pages
- [x] Add tests for recursive `export *`s

---

Closes #54038, closes #54286.
2023-08-30 02:29:14 +00:00
Max Leiter
4c3b7f9b7a
Export RedirectType from next/navigation (#54729)
A continuation of #51864 with RedirectType used in an e2e test and some
ts-ignores removed from the codebase. Happy to split it into two PRs but
I left comments in the two consequential files

---------
2023-08-29 11:05:44 -07:00
Jiachi Liu
8ed492f3c1
Default app router not found (#54199)
Adding a default app router not-found error page in production. We introduced a custom global not-found page if you have `not-found.js` file under app directory. Next.js will still routed you to default pages 404 if there's no routes matched when you don't have a custom `not-found.js`.

This PR creates a default layout (only having `html` and `body`) and will use the default not-found component as children to build a default 404 page for app router, and server will route to that page when there's any app router pages existed. This will also fix the hmr issue that when you hit a pathname doesn't exist, nextjs will compile `/_error` for you which is not expected, now we're using `/not-found` instead

Closes NEXT-1359
2023-08-28 22:09:16 +00:00
Shu Ding
b4a5663c5f
optimize_barrel SWC transform and new optimizePackageImports config (#54572)
## Implementation

Base on #54530, we're implementing a `optimize_barrel` transform to
optimize barrel files to only export the names we need. If the
transformed file isn't a "barrel file", we just re-export the names from
it without any transformation.

Take `lucide-react` as an example, with #54530 we are able to transform

```js
import { IceCream } from 'lucide-react'
```

to 

```js
import { IceCream } from '__barrel_optimize__?names=IceCream!=!lucide-react?__barrel_optimize_noop__=IceCream'
```

And then, we apply that new request with a new Webpack module rule to
use the SWC loader with option `optimizeBarrelExports: ['IceCream']`,
which eventually got passed to this new `optimize_barrel` transform and
does the optimization.

## Notes

We'll have to add a new `getModularizeImportAliases` alias list to map
`lucide-react` to the ESM version, as we have the `['main', 'module']`
resolve order for the server compiler. Otherwise this optimization
doesn't work in that compiler.

There's no e2e test added because it's already covered by the
`modularize-imports` test as we removed the default `lucide-react`
transform rules and it still works.

We'll need to test other libs before migrating them to the new
`optimizePackageImports` option.

---

Closes #54571, closes #53605, closes #53789, closes #53894, closes
#54063.
2023-08-25 22:29:39 +02:00
Tobias Koppers
08d3258762
update turbopack (#54558)
* https://github.com/vercel/turbo/pull/5723 <!-- Alex Kirszenberg - Misc
comments in turbo_tasks -->
* https://github.com/vercel/turbo/pull/5714 <!-- OJ Kwon - test(ci):
update datadog-ci -->
* https://github.com/vercel/turbo/pull/5705 <!-- Justin Ridgewell -
Transformation code necessary to support Server Actions -->
* https://github.com/vercel/turbo/pull/5739 <!-- Justin Ridgewell -
Update rust toolchain -->
* https://github.com/vercel/turbo/pull/5785 <!-- Tobias Koppers - add
evaluatables to chunk list ident -->
* https://github.com/vercel/turbo/pull/5783 <!-- Tobias Koppers -
Tracing improvements -->
* https://github.com/vercel/turbo/pull/5738 <!-- Alex Kirszenberg -
Generic types over Vcs -->
* https://github.com/vercel/turbo/pull/5795 <!-- Leah - fix: snapshot
test path canonicalization -->
* https://github.com/vercel/turbo/pull/5794 <!-- Tobias Koppers - fix
"any" context condition implementation -->
* https://github.com/vercel/turbo/pull/5800 <!-- Tobias Koppers - add
middleware entry type -->
* https://github.com/vercel/turbo/pull/5786 <!-- Tobias Koppers -
perform invalidation directly on writes -->

Closes WEB-1446
2023-08-25 16:22:35 +02:00
Tobias Koppers
4d6febf426
Turbopack: add edge support for pages apis (#54449)
### What?

* add support for middleware manifest and edge adapter for pages API
routes
* improve the error reporting a tiny bit

### Why?

### How?


Closes WEB-1428
2023-08-25 09:11:31 +02:00
Shu Ding
3f1fae947c
Implement named_import_transform (#54530)
This is the first step to enable the automatic "modularize imports"
optimization for some libraries. It transforms named imports like
`import { A, B, C as F } from 'foo'` to a special loader string: `import
{ A, B, C as F } from "barrel-optimize-loader?names=A,B,C!foo"`.

In a follow-up PR we'll apply corresponding optimization with another
SWC transformer.
2023-08-24 22:54:13 +02:00
Zack Tanner
1dffd3c02a
remove HMR polling in favor of more targeted events (#54406)
This removes the client-side polling logic that we're doing on every HMR
tick in favor of events like `addedPage` / `removedPage`. It was leading
to a lot of misc issues & confusion surrounding error/404 pages being
polled needlessly.

Instead this updates `addedPage` / `removedPage` to be emitted on the
server, so that we can leverage those hooks to reload when necessary.

Fixes #10024
Fixes #51132
Closes NEXT-1372
related discussion: https://github.com/vercel/next.js/discussions/40000

---------
2023-08-23 16:25:57 -07:00
Tim Neutkens
00106b7ef4
Optimize webpack memory cache garbage collection (#54397)
## What

Adds a reworked version of webpack's [built-in memory cache garbage
collection
plugin](853bfda35a/lib/cache/MemoryWithGcCachePlugin.js (L15))
that is more aggressive in cleaning up unused modules than the default.

The default marks 1/5th of the modules as "up for potentially being
garbage collected". The new plugin always checks all modules. In my
testing this does not cause much overhead compared to the current
approach which leverages writing to two separate maps. The change also
makes the memory cache eviction more predictable: when an item has not
been accessed for 5 compilations it is evicted from the memory cache, it
could still be in the disk cache.


In order to test this change I had to spin up the benchmarks but these
were a bit outdated so I've cleaned up the benchmark applications.

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-23 15:46:32 +02:00
Balázs Orbán
96a59344e8
fix(app): enable React Strict Mode by default (#53375)
### What?

Let Next.js enable React Strict Mode by default for the App Router.

This caught a bug with the `AppRouterAnnouncer` added in #47018 which
should be fixed as well.

### Why?

This logic:


a0d1d728b9/packages/next/src/build/webpack-config.ts (L326-L333)

assumes that the default value of `reactStrictMode` is `null`, but it
was set to `false` in #46656.

### How?

This PR reverts the default value to `null`.


Closes NEXT-1484
Fixes #53315

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-08-22 20:17:17 +02:00
Shu Ding
5584e5743a
Merge app renderer process (#54143)
This PR merges the app renderer worker into the router process. This
improves the memory overhead mostly.

There're future work to do to get rid of the IPC server for router and
app renderer, as they're now merged in one process.

Fixes NEXT-1492
2023-08-22 14:38:42 +02:00
Zack Tanner
adc413b3fb
add experimental https support to next dev (#54016)
This adds an `--experimental-https` flag to `next dev` which will generate a self-signed certificate via [mkcert](https://github.com/FiloSottile/mkcert) and use it for the dev server.

also supports passing in pre-existing certs via `--experimental-https-cert` and `--experimental-https-key`

x-ref: https://github.com/vercel/next.js/discussions/33768 https://github.com/vercel/next.js/discussions/10935
2023-08-19 01:04:06 +00:00
Kim In Seop
132d3e8f97
fix: invalid module transform for @headlessui/react (#54206)
occured since #54188

- `*`: use kebabcase instead of lowercase
- Transition: `components/transitions/transition`
- Tab: `components/tabs/tabs`

```plain
- wait compiling /not-found (client and server)...
- error ./node_modules/.pnpm/@headlessui+react@1.7.17_react-dom@18.2.0_react@18.2.0/node_modules/@headlessui/react/dist/headlessui.esm.js:2:0
Module not found: Can't resolve '/Projects/node_modules/.pnpm/@headlessui+react@1.7.17_react-dom@18.2.0_react@18.2.0/node_modules/@headlessui/react/dist/components/tab/tab'
```




Co-authored-by: Shu Ding <3676859+shuding@users.noreply.github.com>
2023-08-18 10:33:33 +00:00
Tobias Koppers
45576ae752
Turbopack: more tests and bugfixes for next.rs api (#53809)
### What?

* adds more HMR test cases
* fixes bugs found

### Why?

### Turbopack changes

* https://github.com/vercel/turbo/pull/5668 <!-- OJ Kwon - ci(test):
temporarily increase test timeout -->
* https://github.com/vercel/turbo/pull/5696 <!-- Tobias Koppers -
Cleanup minify -->
2023-08-11 10:29:36 +02:00
JJ Kasper
6b492974b7
Move next-rs API tests from unit to e2e (#53771)
These tests aren't unit per-se as they rely on e2e-utils so this moves
them to the `development` test folder.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1691520079363229)
2023-08-08 21:50:04 -07:00
Eric Fennis
5e716ec918
fix: Update outdated transform imports lucide-react (#53697)
### What?

Fixing outdated import mapping with the latest `lucide-react` changes. See [lucide-icons/lucide@v0.264.0](https://github.com/lucide-icons/lucide/releases/tag/v0.264.0)

Closes: lucide-icons/lucide#1482

### Why?

Import mapping was outdated

### How?

By updating the default config and the tests.

## Notes

Maintainer here from @lucide-icons.
To this day I didn't know the Nextjs default config file has predefined hardcoded modularize imports. 
I was a bit surprised that there is a default mapping for libraries that could change in the future like Lucide. 

I'm not in favor of this hardcoded "modularize imports", because this creates a hard dependency on libraries. With Lucide, we still have not reached 1.0 and will sometimes rename icons and add aliases for them. So issues will occur in the future, and constantly updating this config doesn't feel right. 

Is there, not a better way? Like for example, a package exposing a config file containing the import mapping?
This way import map will automatically be in sync with changes in a package. 

Let me know what you think of this.
2023-08-09 00:48:48 +00:00
Zack Tanner
ee15b3be5d
fix: error overlay hijacking application focus (safari) (#53693)
### What?
When Safari is in the background and HMR triggers a full page reload,
Safari hijacks application focus.

### Why?
Having a `role="dialog"` is correctly prompting Safari to autofocus the
first focusable element (the close button). However, Safari's behavior
seems to also bring the application to the foreground when a background
focus event occurs.

### How?
This only adds the role when the document is focused. 

#### Before

https://github.com/vercel/next.js/assets/1939140/9d2cce52-c6ee-4d49-9262-03620efad86c

#### After

https://github.com/vercel/next.js/assets/1939140/dc7d337c-b621-49e9-9a17-03b5d8b5c3f4

Confirmed voiceover behavior still appears to be correct
<img width="1371" alt="CleanShot 2023-08-07 at 12 14 34@2x"
src="https://github.com/vercel/next.js/assets/1939140/e53acfbc-cf6b-4d74-8b83-cf98edb2c2ab">

slack x-ref:
https://vercel.slack.com/archives/C03KAR5DCKC/p1691264077313599

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-08 21:45:03 +02:00
Tim Neutkens
c5a8e0989e
Consolidate Server and Routing process into one process (#53523)
In the current version of Next.js there are 4 processes when running in
production:

- Server
- Routing
- Rendering Pages Router
- Rendering App Router

This setup was introduced in order to allow App Router and Pages Router
to use different versions of React (i.e. Server Actions currently
requires react@experimental to function). I wrote down more on why these
processes exist in this comment:
https://github.com/vercel/next.js/issues/49929#issuecomment-1637185156

This PR combines the Server and Routing process into one handler, as the
"Server" process was only proxying to the Routing process. In my testing
this caused about ~2x the amount of memory per request as the response
body was duplicated between the processes. This was especially visible
in the case of that memory leak in Node.js 18.16 as it grew memory usage
on both sides quickly.

In the process of going through these changes I found a couple of other
bugs like the propagation of values to the worker processes not being
awaited
([link](https://github.com/vercel/next.js/pull/53523/files#diff-0ef09f360141930bb03263b378d37d71ad9432ac851679aeabc577923536df84R54))
and the dot syntax for propagation was not functioning.

It also seemed there were a few cases where watchpack was used that
would cause many more files to be watched than expected, for now I've
removed those cases, specifically the "delete dir while running" and
instrument.js hmr (instrument.js is experimental). Those tests have been
skipped for now until we can revisit them to verfiy it

I've also cleaned up the types a bit while I was looking into these
changes.

### Improvement

⚠️ Important preface to this, measuring memory usage / peak usage is not
super reliable especially when JS gets garbage collected. These numbers
are just to show the rough percentage of less memory usage.

#### Baseline

Old:

```
next-server: 44.8MB
next-router-worker: 57.5MB
next-render-worker-app: 39,6MB
next-render-worker-pages: 39,1MB
```

New:

```
next-server: Removed
next-router-worker: 64.4MB
next-render-worker-app: 43.1MB (Note: no changes here, this shows what I meant by rough numbers)
next-render-worker-pages: 42.4MB (Note: no changes here, this shows what I meant by rough numbers)
```

Overall win: ~40MB (process is removed)

#### Peak usage

Old:

```
next-server: 118.6MB
next-router-worker: 223.7MB
next-render-worker-app: 32.8MB (I ran the test on a pages application in this case)
next-render-worker-pages: 101.1MB
```

New:

```
next-server: Removed
next-router-worker: 179.1MB
next-render-worker-app: 33.4MB
next-render-worker-pages: 117.5MB
```

Overall win: ~100MB (but it scales with requests so it was about ~50% of
next-router-worker constantly)

Related: #53523

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-08-08 16:06:32 +02:00
Zack Tanner
fef6f82aba
Add docs page for uncaught DynamicServerErrors (#53402)
When using imports from `next/headers` in a layout or page,
`StaticGenerationBailout` will throw an error to indicate Next.js should
fallback to dynamic rendering. However, when async context is lost, this
error is uncaught and leads to a confusing error message at build time.

This attempts to improve DX surrounding this error by linking out to a
page that explains when it might happen. I've also tweaked
`StaticGenerationBailout` to always throw a fully descriptive reason as
opposed to just `DynamicServerError: Dynamic server usage: cookies`

Closes NEXT-1181
Fixes #49373

---------

Co-authored-by: Lee Robinson <me@leerob.io>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-08-08 12:49:53 +02:00
JJ Kasper
7bf3d77b5e
Revert "Implement new forking technique for vendored packages. (#51083)" (#53640)
This reverts commit e06880ea4c.

reverts: https://github.com/vercel/next.js/pull/51083

x-ref: [slack
thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1691349686136519)
x-ref: [slack
thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1691349579712979?thread_ts=1691217652.833079&cid=C03S8ED1DKM)
2023-08-06 13:00:12 -07:00
Leah
542c4fc26a
chore: update to pnpm@8.6.11 (#50923)
https://github.com/pnpm/pnpm/releases/tag/v8.0.0
2023-08-04 19:40:20 +00:00
Adrian Bettridge-Wiese
3c84b3ac99
Add useOptimistic to client-only errors (#53313)
### What?
This PR makes it so calling `experimental_useOptimistic` throws an error telling you it only works in a client component. Because the Next docs have an example of renaming it into `useOptimistic` in the import, I also added that as a forbidden import. There may be a better way to do this, if so, please let me know.

Fixes #53312 

### Why?
Currently, the error you get says `(0 , react__WEBPACK_IMPORTED_MODULE_1__.experimental_useOptimistic) is not a function or its return value is not iterable`. This is misleading.
<img width="1043" alt="Screenshot 2023-07-28 at 3 30 10 PM" src="https://github.com/vercel/next.js/assets/12662580/ee16fd84-633d-47a1-8db4-cfc050546614">

### How?
Adds `experimental_useOptimistic` to the lists of forbidden imports. Adds some specific tests around this, but I'm not sure they're necessary, looking at how the other tests are written.

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2023-08-03 07:21:00 +00:00
Tobias Koppers
61baae126f
fix Next.rs API (#53456)
### What?

* fixes problems in Next.rs API introduced by #52846 
* adds test infrastructure for experimental turbo testing
* adds two test cases to verify the infrastructure
* add grouping of output logs in run-tests
* simplify template loading

### Why?

### How?
2023-08-02 14:31:52 +02:00
Shu Ding
b31b0ee0cc
Add list of aliased lucide-react icons to the transform rules (#53483)
`lucide-react` follows the naming rule of `LucideName`, `NameIcon` and `Name` being exported from `/icons/{{ kebabCase Name }}`, but it has some special aliases such as `Stars` exported from `/icons/sparkles`. For now we have to add these rules manually.

Fixes https://github.com/vercel/next.js/pull/53051#issuecomment-1656211058. In the future we'll still need an automatic way to do this.

The list was created from https://unpkg.com/lucide-react@0.263.1/dist/esm/lucide-react.mjs.
2023-08-02 11:38:40 +00:00
Shu Ding
555ff3bcdb
Improved modularizeImports rules (#53051)
This PR adds some improved `modularizeImports` rules to ensure that some
of the popular UI libraries (mostly icons) can be correctly optimized
instead of creating thousands of modules. Here's an example of applying
this to `lucide-react`:

![CleanShot 2023-07-22 at 19 34
15@2x](https://github.com/vercel/next.js/assets/3676859/cf9ef13f-1d5d-4df6-9097-364983ea7b8b)

With https://github.com/swc-project/plugins/pull/196 being landed, we
can add different transform rules for specific names in the import. For
example, for `lucide-react` there're now 3 transforms:
- `'Lucide(.*)': ...`
- `'(.*)Icon': ...`
- `'*': ...`

On top of that, another critical change made in this PR is the
introducing of `modularize-import-loader`. With this new loader, we can
delegate the task of re-exporting the value to Webpack, where we can
adjust the type of the export and the target path. This is very
necessary and can't be done in SWC alone because libs like
`lucide-react` is using `.mjs` and don't have `exports` values for the
individual icons in the package.json files.

Because of that, if we simply transform the expression to `import Icon
from 'lucide-react/esm/icons/foo` it will fail because:
1. It's missing a `.mjs` extension
2. It doesn't have `/esm/icons/foo.mjs` in package.json `exports`

For 1), in fact that they moved to `.mjs` only in a recent upgrade so we
can't even hard code it to be `.mjs` in the transform (breaks old
versions).

Because of all the above, I decided to go with Webpack's own resolution
logic with the loader as a _temporary_ solution. It's temporary because
it's still assuming that the file structure of these libs doesn't
change.
2023-07-27 16:08:25 +02:00
Zack Tanner
ea4f6a0258
add hydration error testcase when using useId() in a client component (#53223)
Quick follow up to https://github.com/vercel/next.js/pull/53216 to add a missing test case
2023-07-26 18:46:42 +00:00
Steven
8dede2a4f5
chore(test): fix flaky tsconfig.json test (#53132)
This test was [sometimes failing](

https://github.com/vercel/next.js/actions/runs/5649220907/job/15303327768?pr=53130#step:27:230)
because the `tsconfig.json` is [written as an empty
object](a26bac9604/packages/next/src/lib/typescript/writeConfigurationDefaults.ts (L123-L125)).

This PR makes sure the test waits until the tsconfig.json file is
written with the complete contents.
2023-07-24 14:33:55 -07:00
Zack Tanner
4994a428ae
improve error DX on pages with RSC build errors (#52843)
### What?
- Visiting a page in the app router without a proper component export doesn't show the dev overlay, but logs errors to the console
- When it does show the error overlay (e.g. during an HMR event), the error message was sharing the module code itself rather than the component path, making it hard to debug

### Why?
`createComponentTree` can throw these errors before the AppRouter tree is mounted, leaving the errors uncaught by the dev overlay.

### How?
This wraps the server root in the `ReactDevOverlay` when in dev mode with a minimal "HMR" for when the server component is edited (to reload the page).

Closes NEXT-308
2023-07-20 00:32:57 +00:00
Facundo Giuliani
a26bac9604
Update default moduleResolution in tsconfig.json from node to bundler (#51957)
This updates our `moduleResolution` to `bundler` as this matches our heuristics much more closely so is more accurate. This shouldn't be a breaking change is it should be compatible with our previous default. 

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2023-07-18 15:11:09 +00:00
Tim Neutkens
98a8b1cca6
Set process.title for router and render workers (#52779)
- Adds `next-router-worker` as the process title for the routing worker.
- Adds `next-render-worker-app` as the process title for the rendering
worker for `app`
- Adds `next-render-worker-pages` as the process title for the rendering
worker for `pages`

Currently it's hard to find these processes in e.g. activity monitor,
this helps explain what they are used for when someone is looking at the
running processes.

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

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

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

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

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


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2023-07-17 19:55:02 +02:00
Steven
525ffb4334
chore: remove experimental appDir: true from tests (#52291)
The experimental flag is no longer needed.

https://nextjs.org/blog/next-13-4
2023-07-05 19:17:29 -07:00
Tobias Koppers
fd508b086c
fix env reloading for turbopack (#52194)
### What?

fixes WEB-1258
2023-07-04 19:28:34 +00:00
Jiachi Liu
c87a1b12c3
fix: env hot reload for RSC pages (#51930)
### Issue
When you edit .env* files, the pages under app dir that using env vars are not triggering hot reload

### Fix
Triggering serverComponentChanges hot reload action when we detect env or tsconfig related change. There's a time period that we need to wait before the compilation is finished. First we save a flag `reloadOnDone` if we need to reload when after compilation is done, by determining if `envChange` is `true` (we already know this in dev server). Then in the compilation hooks, we refresh RSC page once it's finished.

### Extra change 

since we're checking `event.action` in client hot reloader, and throwing error for unknown action, filter devPagesManifestUpdate out from unexpected action as it sometimes triggered as error in console. Introduced in #51516
Fixes NEXT-1261
2023-07-03 10:11:28 +00:00
Leah
5ff4817749
fix app-hmr-changes.test.ts by updating next-tweet (#52046) 2023-06-30 23:09:09 +00:00
Leah
c1c3675fc4
refactor tests for readability (#51051)
You'll probably want to disable whitespace in the diff

## Description

This allows for better editor support by using `describe` or functions called `describe` with the same syntax instead of custom names.

Changes:
- `nextTestSetup` can be used instead of `createNextDescribe` keeping the same behaviour but being called inside a `describe` "block" (not applied everywhere)
- `getSnapshotTestDescribe` replaced with a custom `describe.each`
- `sandbox` helper function for `acceptance`/`acceptance-app` merged into a single shared one
- `outdent` to remove the indent from inline files in tests which helps with consistent snapshots
2023-06-21 19:47:21 +00:00
Shu Ding
3847592e44
Add docs links to RSC errors (#51557)
When working with React Server Components, it's essential to have a
clear understanding of how they function and how to troubleshoot any
errors that may arise. This PR adds links to our documentation whenever
an error related to React Server Components occurs.
2023-06-20 23:40:15 +02:00
JJ Kasper
29c2e89bd1
Break up large test suites (#50458)
This breaks up some of our longest running tests which allows more
parallelizing of the tests. This also moves turbopack tests filtering
back to an allow list as it is running a lot of unrelated tests
currently which isn't ideal. We should only be running against tests
that are explicitly testing turbopack e.g. build tests should not be
duplicated in the turbopack group.

```sh
test/integration/css/test/group-1.test.js: 762.655
test/integration/edge-runtime-module-errors/test/index.test.js: 695.309
test/integration/css/test/group-2.test.js: 671.848
test/integration/i18n-support/test/index.test.js: 518.173
test/integration/scss-modules/test/index.test.js: 451.704
test/integration/css-features/test/index.test.js: 417.318
test/integration/css-modules/test/index.test.js: 403.405
test/integration/eslint/test/index.test.js: 381.563
test/integration/500-page/test/index.test.js: 371.134
test/integration/telemetry/test/index.test.js: 367.691
test/development/acceptance-app/ReactRefreshLogBox.test.ts: 335.878
test/integration/create-next-app/templates.test.ts: 334.01
test/integration/scss/test/group-2.test.js: 327.255
test/integration/scss/test/group-1.test.js: 318.574
test/integration/edge-runtime-configurable-guards/test/index.test.js: 313.834
test/e2e/instrumentation-hook/instrumentation-hook.test.ts: 294.618
test/development/acceptance-app/error-recovery.test.ts: 283.355
test/e2e/app-dir/app/vercel-speed-insights.test.ts: 278.242
test/integration/create-next-app/index.test.ts: 272.442
```
2023-05-28 13:59:41 -07:00
JJ Kasper
a3ab542630
Add new build and test workflow (#50436)
This adds new `build and test` and `build and deploy` workflows in favor
of the existing massive `build, test, and deploy` workflow. Since the
new workflows will use `pull_request_target` this waits to remove the
existing workflow until the new one is tested.

While testing this new workflow flakey behavior in tests have also been
addressed. Along with the new workflow we will also be leveraging new
runners which allow us to run tests against the production binary of
`next-swc` so this avoids slight differences in tests we've seen due to
running against the dev binary.

Furthermore we will have a new flow for allowing workflow runs on PRs
from external forks which will either require a comment be checking a
box approving the run after each change or a label added by the team.

The new flow also no longer relies on `actions/cache` or similar which
have proven to be pretty unreliable.

Tests runs with the new workflow can be seen here
https://github.com/vercel/next.js/actions/runs/5100673508/jobs/9169416949
2023-05-27 21:02:31 -07:00
Tobias Koppers
fe6bb0ace9
Refactor internal modules (#50338)
### What?

create internal modules via `context.process` with
`ReferenceType::Internal`

### Why?

We need this for future refactoring where we want to the internal
modules with transitions.

### Turbopack Changes

* https://github.com/vercel/turbo/pull/5095 <!-- Tobias Koppers - allow
to create internal modules via AssetContext -->
* https://github.com/vercel/turbo/pull/5104 <!-- Alex Kirszenberg -
Stable chunk list ident -->
* https://github.com/vercel/turbo/pull/5106 <!-- Tobias Koppers -
followup fix -->

---------

Co-authored-by: Alex Kirszenberg <alex.kirszenberg@vercel.com>
2023-05-27 08:22:15 +02:00
Wyatt Johnson
a56066c5ab
Pages Route Module (#50070)
This exports the named exports from the user's page route file and
exports a new `routeModule` stub. This stub will be the new rendering
mechanism used for pages within `pages/` and will serve to allow us to
deprecate large chunks of the server code to instead live within the
pages entrypoints.

TLDR;

- Route Modules now accept a `definition` so that they have their full
route definition
- Exports are now hoisted from the userland module by name to prevent
name collisions
- A new `PagesRouteModule` stub was added that will in the future
contain all the pages rendering logic

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-05-26 19:17:43 +02:00
Jiachi Liu
7641278f82
Fix port value for metadataBase (#49924)
metadataBase is using `process.env.PORT` to construct a host when there's no `metadataBase` specified in layout. Dev server needs to pass down the PORT env from the parent prcoess.

Fixes #49807
Fixes #49859
Closes #49889
2023-05-17 13:37:47 +00:00
Lee Robinson
fa1370fd9b
Update links from beta to stable docs. (#49349)
Now that the beta docs have been merged into stable with the release of
13.4, this updates all links as some paths have changed due to
redirects.

---------

Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-05-11 11:52:29 -07:00
Tim Neutkens
25a9547cad
Remove experimental config from create-next-app (#49241)
## What?

Removes `experimental.appDir` this was leftover from when I flipped the
switch.

Kept the config file as in the future we might add future flags and
such. It also helps that it has the types comment included so you always
get types.

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

## For Contributors

### Improving Documentation or adding/fixing Examples

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

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

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



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-05-05 00:22:28 -07:00
JJ Kasper
30f84e31b4
Update dev logs to include request timings (#49191)
This updates our dev logs to include request timings and also includes
fetch timings in app directory to including info on whether the cache
was leveraged or not allowing easier debugging of contributing factors
to render times. In the future we can expand to include middleware
timings separate as well to single that out along with timings for
`getStaticProps` potentially as well.


<details>

<summary>Screenshot</summary>

![CleanShot 2023-05-04 at 00 13
19@2x](https://user-images.githubusercontent.com/22380829/236135624-da1d873b-5abf-42d0-9708-8e20d1c56cef.png)

</details>

<details>

<summary>Screenshot</summary>

![CleanShot 2023-05-04 at 00 13
32@2x](https://user-images.githubusercontent.com/22380829/236135642-bc974b82-13e0-47f0-8be5-581d92077fc1.png)

</details>

<details>

<summary>Screenshot</summary>

![CleanShot 2023-05-04 at 00 13
47@2x](https://user-images.githubusercontent.com/22380829/236135664-5b2975ce-fa78-40d5-b320-d42d35b17541.png)

</details>

x-ref: [slack
thread](https://vercel.slack.com/archives/C042LHPJ1NX/p1681418590738249)
2023-05-04 12:33:03 -07:00
Shu Ding
b5f7f84485
Refactor require hooks (#48506)
Same purpose as #48297, but without the React channel branching logic to
make it easier to land. Since we have #48478 reverted, we only need to
consider `pages` and `app` inside the require hook.

> This PR aims to improve the current require hook by implementing two
key changes. Firstly, it ensures that the initialization occurs at the
top of the module level for correctness. Secondly, we now set the
NEXT_PREBUNDLED_REACT environment variable at the process level to
ensure that we don't mix the two types of rendering processes and we
always resolve the correct React package.
>
> These improvements are made possible by the changes introduced in PR
https://github.com/vercel/next.js/pull/47857.
> 
> Closes [NEXT-231](https://linear.app/vercel/issue/NEXT-231).

This will likely fix #45258 too.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-04-22 00:19:51 +02:00
Jiachi Liu
acd3b25ef5
remove amp error in app dir (#48620)
Follow up for #48489 

As config is dropped and we can only check server components previously.
We can remove it now
2023-04-20 14:18:57 +00:00
Tim Neutkens
1865a6e3d9
Don't build pages before middleware (#48339)
### What?

The team working on vercel.com reported that multiple pages were being
compiled when opening a single page. Investigated this a bit and found
it was caused by the matching logic (that also triggers compiling of
matched pages) running before middleware runs.

### How?

Removed this matcher logic, as far as I can tell it's not actually being
used. Probably a leftover from when we provided `page` as a middleware
parameter before we made middleware run in front of all resolving.

Fixes NEXT-999
Fixes NEXT-806

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

## For Contributors

### Improving Documentation or adding/fixing Examples

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

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

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



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
2023-04-18 12:28:49 +02:00
OJ Kwon
e97100c5ea
feat(turbopack): support initial compiler.emotion / compiler.styledComponents flag (#47991)
<!-- 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:

## For Contributors

### Improving Documentation or adding/fixing Examples

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

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

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



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### Why?

### How?

Closes NEXT-
Fixes #

-->

### What?

Related with WEB-669 and initial support for
[WEB-670](https://linear.app/vercel/issue/WEB-670), allows to consume
compiler.emotion with latest turbopack.

I was trying to make additional changes to make test fully pass, but
there are some other failures around so this change cannot able to pass
existing tests yet.

Turbopack changes: https://github.com/vercel/turbo/pull/4482
2023-04-12 22:05:18 +02:00
Hannes Bornö
2cb5876b7b
Enable opening source file in build error overlay (#48194)
It's only possible to open the source file in the editor on runtime
errors:
<img width="951" alt="image"
src="https://user-images.githubusercontent.com/25056922/230925905-b6741246-90f3-4c5a-8211-f3b85cc63275.png">

For build errors, the source file is just part of the error message, and
not clickable:
<img width="934" alt="image"
src="https://user-images.githubusercontent.com/25056922/230926579-ba803272-90f5-4366-aec0-176ea6489c3e.png">

This PR makes the source file clickable on build errors as well:
<img width="947" alt="image"
src="https://user-images.githubusercontent.com/25056922/230926886-4ba18f54-be52-49b4-9421-1c6282d823a9.png">

---------

Co-authored-by: Hannes Bornö <hannesborno@Hanness-MacBook-Pro.local>
2023-04-10 20:13:34 +02:00
Steven
86cb8ec8e2
fix: handle error case for output: export in next dev (#47768)
fix NEXT-929
2023-04-06 19:20:47 +02:00
Jan Kaifer
2c9b484fc1
Auto-restart dev server when next.config.js changes (#47912)
This is a follow-up PR on https://github.com/vercel/next.js/pull/46577
after it got nasty conflicts.

Basically, just restart `dev` when `next.config.ts` it will just restart
instead of printing that message asking you to restart.
fix NEXT-639
2023-04-05 18:17:54 +00:00
JJ Kasper
fdacca8abc
Add initial separated route resolving (#47208)
This updates to have a separate routing process and separate rendering
processes for `pages` and `app` so that we can properly isolate the two
since they rely on different react versions.

Besides allowing the above mentioned isolation this also helps us
control recovering from process crashes easier as pieces are more
isolated from one another e.g. an infinite loop during rendering will no
longer block the compiler and can be stopped/restarted as needed.

In follow-up PRs we will continue to separate out the routing logic from
the rendering logic so that each process only loads what is relevant to
it helping simplify the flow for requests regardless of type.

---------

Co-authored-by: Shu Ding <g@shud.in>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-02 15:17:15 +02:00
JJ Kasper
318642a1d9
Update flakey app dev tests (#47504)
x-ref:
https://github.com/vercel/next.js/actions/runs/4513582756/jobs/7948722605
x-ref:
https://github.com/vercel/next.js/actions/runs/4513582756/jobs/7948722818
x-ref:
https://github.com/vercel/next.js/actions/runs/4513366262/jobs/7949059763
2023-03-24 15:44:44 -07:00
Shu Ding
e42a3d6d48
Fix loader rule with wrong matching conditions (#47261
This Webpack loader rule should have the exactly same conditions as


828fd5a162/packages/next/src/build/webpack-config.ts (L1940-L1951)

Except that it matches 2 special layers and an extra loader.
2023-03-17 23:35:02 +01:00
Shu Ding
4c3f59f88d
Implement server entry creation in client layer (#47127
In short, this PR adds a 3rd layer to the server compiler. This extra
layer is for marking the modules when re-entering the server layer from
a client component. It is almost identical to the existing server layer
and it should have all the same bundling and runtime behaviors, but it's
still special because it's not allowed to enter the client layer again
from there.

Because of that, we create the extra entry for that new layer when the
client layer compilation finishes in the `finishModules` phase. The new
entry is handled normally as it's in the server layer. But the original
module in the client layer will be compiled specially as special no-op
exports, and will then be connected via the `callServer` wrapper.

fix NEXT-809 ([link](https://linear.app/vercel/issue/NEXT-809)).
2023-03-15 23:58:18 +01:00
Jiachi Liu
0bee9e6f92
test: update amp test to always check redbox (#47050) 2023-03-12 20:44:23 +00:00
Hannes Bornö
9a41ba9ac4
Improve RSC compiler error in external module (#46953)
When the RSC compiler error was caused by an external package, make the
error message display which import caused the error. Also don't show
node_module files in the import trace.

Continuation of https://github.com/vercel/next.js/pull/45484

Before

![image](https://user-images.githubusercontent.com/25056922/224032476-6811a1d5-d690-48be-9602-781f459edc70.png)

After

![image](https://user-images.githubusercontent.com/25056922/224032177-2d0b2977-098f-46bd-8e30-9e6bc21b9153.png)

Updates the format of the files, from `app/page.js` to `./app/page.js`
to align it with other import traces.

![image](https://user-images.githubusercontent.com/25056922/224030420-1d3ff0ba-5747-4ed3-8b0b-9c4deace54ea.png)


Closes NEXT-523
2023-03-09 12:27:57 -08:00
Hannes Bornö
09d21d6e99
Move error overlay recovery tests to new file (#46965)
Move error overlay recovery tests in `ReactRefreshLogBox.test.ts` to a
new file. This is already done for the app router tests, but this does
it for the old router as well. Makes `ReactRefreshLogBox.test.ts` faster
to run.
2023-03-09 12:15:30 -08:00
Hannes Bornö
0e073366da
Reduce the number of hydration error tests (#46930)
`test/development/acceptance-app/hydration-error.test.ts` has a lot of tests because I ported all the tests in https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js. Running all those tests takes a lot of time, and to include all the different cases is overkill.

This PR removes most tests but keeps one test case per type of hydration error, and also one using suspense. This makes more sense, it should only test that all the different hydration error messages are picked up.
2023-03-08 16:41:21 +00:00
Shu Ding
105e5b0088
Add retry to the hmr acceptance test (#46902)
This one seems to be flaky ([example](https://github.com/vercel/next.js/actions/runs/4357945817/jobs/7618498044)) as the default `page.goto` timeout is set to 30s, while it already takes 15~20s to load locally on my laptop. So let's add some retries here.
2023-03-07 22:39:50 +00:00
Hannes Bornö
d59aa9655e
Port error overlay hydration error to pages directory (#46677)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-03-06 19:40:25 -08:00
Jiachi Liu
63d81de6bc
test: add preconnect tests and move error tests (#46652)
* Add tests for `ReactDOM.preconnect | prefetchDNS | preload` usage
* Move mutate erroring tests to rsc-build-errors test suite
2023-03-01 23:09:16 +00:00
Shu Ding
5532b6a93f
Fix app client child entry not being disposed when deleting the file (#46583)
Currently if a file or folder (that contains an entry) is renamed in app dir, the dev server will stop working because we never remove the old entry. Since all client entries in app dir are created as child entries programmatically via the RSC plugin, they're different and not handled by our existing hot reloader logic:

f0cbe84e4c/packages/next/src/server/dev/hot-reloader.ts (L666-L677)

This PR adds a file path to child entries as well (it can be layout, page and other entries) so in the entry generation step we can prune the invalid ones.

Fixes #46379, fixes NEXT-650.

## 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-02-28 23:32:03 +00:00
JJ Kasper
619c76c0f9
Fix infinite invalidations loop in app dir (#46526)Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This fixes a case where depending on the timings of compilers being done
could cause an infinite invalidation loop.

**Before**


https://user-images.githubusercontent.com/22380829/221786587-1a4cc6ab-f273-4191-92af-a57e9fff1261.mp4

**After**


https://user-images.githubusercontent.com/22380829/221786611-f55c3da9-0201-40be-95a8-3ef1869d6a66.mp4

x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1677441845988529?thread_ts=1677429424.151329&cid=C03KAR5DCKC)

## 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-02-28 11:07:29 +01:00
Hannes Bornö
ce234fb9ad
Add error for styled-jsx in Server Component (#46482)
Add specific error for the `styled-jsx` import that's implicitly added
to the file when using `<style jsx>`.

Before

![image](https://user-images.githubusercontent.com/25056922/221547281-7b25a979-ee03-4d29-97c8-a038b9ebb214.png)

After

![image](https://user-images.githubusercontent.com/25056922/221547152-ed122163-93e5-48ae-bf95-484388f462ea.png)

Fixes NEXT-669

## 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-02-27 15:04:34 +01:00
Jan Kaifer
714720ffa9
dynamic = "error" violations should be shown in error overlay (#45893
dynamic = "error" should throw in dev mode, currently, it just gets
ignored.
It doesn't throw a nice custom error, but at least it isn't silently
ignored anymore.

Build behavior stays the same.
2023-02-27 12:20:23 +01:00
Shu Ding
516bc83296
Fix SWC error wrongly formatted (#46412)
We currently use the `NEXT_RSC_ERR_INVALID_API` error code for metadata API conflicts which is wrong. The format should be `NEXT_RSC_ERR_INVALID_API: foo` and then the formatter transforms it into `foo isn't supported in app/`.

This PR adds a new `NEXT_RSC_ERR_CONFLICT_METADATA_EXPORT` error code and improves the message. Closes #46406.

## 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-02-25 14:00:06 +00:00
Kevin Wang
b942a6f494
chore: improve error when exporting metadata from client component (#46334)
<!--
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:
-->

This improves the ambiguous error seen when exporting `metadata` or
`generateMetadata` from a component marked with the `"use client";`
directive.

Example output from tests (`pnpm test-dev
test/development/acceptance-app/rsc-build-errors.test`)

```console
File path:
  app/client-with-errors/metadata-export/page.js
  console.log
    browser log: ./app/client-with-errors/metadata-export/page.js
    ReactServerComponentsError:
    
    You are attempting to export "generateMetadata" from a component marked with "use client", which is disallowed. Either remove the export, or the "use client" directive. Read more: https://beta.nextjs.org/docs/api-reference/metadata
    
       ,-[6:1]
     6 | 
     7 | // export const metadata = { title: 'client-metadata' }
     8 | 
     9 | export async function generateMetadata() { return { title: 'client-metadata' } }
       :                       ^^^^^^^^^^^^^^^^
       `----
    
    File path:
      app/client-with-errors/metadata-export/page.js
```

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] 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

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

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-02-24 21:23:32 -08:00
Hannes Bornö
d38035ccf1
Make build error urls clickable (#46251)
Makes urls in build errors clickable by turning them into `<a>`. Reuses the `<HotlinkedText />` component in build errors that previously only was used in runtime errors.  Also fixes an error that made the links break if they had `\n` before or after the url.

Fixes NEXT-586

## 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-02-22 18:35:38 +00:00
Hannes Bornö
b8837ad636
fix file name in next/font unresolved import error (#46187)
Use the actual file name in the overlay when a local font can't be resolved.

Before
![image](https://user-images.githubusercontent.com/25056922/220339649-86d1ede7-178e-4d88-820a-0eda6bd7ba18.png)

After
![image](https://user-images.githubusercontent.com/25056922/220339492-1d5a755f-5393-4121-b30d-32b49574035a.png)

Fixes NEXT-600

## 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-02-22 01:48:56 +00:00
Hannes Bornö
a5ef594a1a
Update flaky dev tests (#46179)
ref:
[slack](https://vercel.slack.com/archives/C04DUD7EB1B/p1676914009577859)

## 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>
2023-02-21 14:28:25 -08:00
Hannes Bornö
9e86fd1d58
Fix "use client" in pages dir errors (#46191)
When in the pages dir, the compiler errors where the `"use client"` directive is used incorrectly should tell the user how to fix the error - not just say:
```
You have tried to use the "use client" directive which is not supported in the pages/ directory.
```

This removes those cases and instead displays the same error as in the app dir. However, if you try to import something that requires it to be a Server Component, the pages error is still:
```
That only works in a Server Component which is not supported in the pages/ directory.
````

ref: [slack](https://vercel.slack.com/archives/C035J346QQL/p1676983422753729)

## 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-02-21 14:07:41 +00:00
Hannes Bornö
b3f3bf59b9
Improve app-render error log with edge runtime (#46157)
`app-render` server errors aren't logged correctly with the edge runtime. This adds logging of a filtered stack trace.

Before
![image](https://user-images.githubusercontent.com/25056922/220144922-06aba048-0166-4114-8421-8f61e6137d5e.png)

After
![image](https://user-images.githubusercontent.com/25056922/220145019-83c1cf80-d6c7-4ce0-b76f-201265c7fafb.png)

Still some improvements left to figure out. This change doesn't log the original stack frame, and the `Log.error` is not printed with a red text like it should be.

Fixes NEXT-593

## 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-02-20 16:24:15 +00:00
Hannes Bornö
a9b56610e1
Send correct stats in hot reloader sync event (#46150)
If there's a build error on initial page load, the error is sometimes displayed as a server error instead of a build error:
![image](https://user-images.githubusercontent.com/25056922/220099125-5f538551-342f-4bca-a670-a04d8428de2d.png)

When the hot reloader sends the `sync` event to the client, it always picks the latest compilation. The problem occurs if only the server has errors and the client is the latest. In that case the server errors are ignored and the client stats are sent instead.

This PR makes it check if the server compilation has errors, if that's the case we use those stats. `built` events acts the same, new client builds are [ignored if the server has errors](https://github.com/vercel/next.js/blob/canary/packages/next/src/server/dev/hot-middleware.ts#L123.): 
```ts
onClientDone = (statsResult: webpack.Stats) => {
  this.clientLatestStats = { ts: Date.now(), stats: statsResult }
  if (this.closed || this.serverLatestStats?.stats.hasErrors()) return
  this.publishStats('built', statsResult)
}
```

Fixes NEXT-403

## 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-02-20 12:55:29 +00:00
Jiachi Liu
2f967ccd48
Detect invalid metadata exports errors in next-swc (#46077)
* Use next-swc to detect invalid metadata exports
* In client components page under app dir, metadata exports are not
available
* In server components page under app dir, metadata and gM exports can
be exported together

Move sync metadata / async metadata typing resolving test to UT

Closes NEXT-368

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-02-19 08:36:50 +01:00
Hannes Bornö
70c087e4cf
Fix flaky invalid import test (#46089)
<!--
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)
2023-02-18 12:33:06 +01:00
Hannes Bornö
bac00ba7d7
@next/font migration warning (#46036)
Print warning with migration instructions if `@next/font` is in deps.

Fixes NEXT-483

## 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: Tim Neutkens <tim@timneutkens.nl>
2023-02-17 16:39:26 +01:00
Balázs Orbán
c16e28715f
feat: show version staleness in error overlay (#44234)Co-authored-by: Sukka <isukkaw@gmail.com> Co-authored-by: Steven <steven@ceriously.com> Co-authored-by: Hannes Bornö <hannes.borno@vercel.com> Co-authored-by: Hannes Bornö <borno.hannes@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Supersedes #37750 as the overlay has been refactored and moved into the
Next.js package itself.

If it detects an older major version, it will show "outdated". Older
minor shows "out of date". Old canary will show "out of date", with a
different message. Matching latest canary or latest will show "up to
date". It will show nothing if we could not detect the versions due to
some error.

<details>
<summary>States: Fresh, stale, outdated</summary>

Fresh:

![image](https://user-images.githubusercontent.com/18369201/208972067-8f2bd8d5-bb92-440a-a3aa-0685b18b4871.png)


Stale:

![image](https://user-images.githubusercontent.com/18369201/208971789-baec0b90-718a-4cdc-bb15-ed23ce5efcbc.png)


Outdated:

![image](https://user-images.githubusercontent.com/18369201/208972153-923ab865-e0f7-405d-9411-45ad1f545d0e.png)

</details>

Fixes NEXT-316

---------

Co-authored-by: Sukka <isukkaw@gmail.com>
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Hannes Bornö <hannes.borno@vercel.com>
Co-authored-by: Hannes Bornö <borno.hannes@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-02-17 16:18:28 +01:00
Hannes Bornö
435eca3fc5
Add next/font import (#45891)
Enables using `next/font` by adding `@next/font` as a dependency and
reexporting its loaders.

Always generates the `font-loader-manifest` as we can't know beforehand
if the user intends to use `next/font` or not.

Also adds telemetry for `next/font` usage.

The tests are updated to use `next/font`. But `@next/font` is tested in
`test/e2e/next-font/index.test.ts` and `test/e2e/app-dir/next-font` as
well to ensure it doesn't break.

Fixes NEXT-351

## 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-02-16 15:33:39 +01:00
Hannes Bornö
1127df4d6a
Make app-render error logging less verbose in dev (#45472)
Make the app-render error less verbose in dev. Reuse
`logErrorWithOriginalStack` from the dev server but hide frames from
`node_modules`, `next/dist/compiled` and `node:internal` if we're in the
app directory. Also removes `webpack-internal` from the frame file name.

<details>
<summary>Before</summary>


![image](https://user-images.githubusercontent.com/25056922/215798020-9aea3401-95dd-4f09-9e4c-26d822c0ce38.png)
</details>

<details>
<summary>After, with source</summary>


![image](https://user-images.githubusercontent.com/25056922/216609074-66039be9-f599-47af-8c5d-b64a6be503ab.png)
</details>

<details>
<summary>After, no source</summary>


![image](https://user-images.githubusercontent.com/25056922/216608526-46ada990-7e6f-4c9e-b1d3-347ebb03f6fa.png)
</details>

<details>
<summary>For comparison, from `pages/`</summary>


![image](https://user-images.githubusercontent.com/25056922/216610761-dd87e5e6-1e9c-4b41-8adf-650cf15464e3.png)
</details>

Fixes NEXT-441

## 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-02-14 18:46:30 -08:00
Hannes Bornö
c01f8da559
Improve server-only imported in external package error (#45749)
Fail at build time with helpful message instead of getting a runtime error when external package imports 'server-only' in a Client Component.

Before
![image](https://user-images.githubusercontent.com/25056922/217865154-57fd821c-9502-4e0a-a31c-19f2f89b5847.png)


After
![image](https://user-images.githubusercontent.com/25056922/217864843-b30702e7-38c7-4edc-b42a-31a2eb3a301f.png)

Fixes NEXT-494

## 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-02-15 01:54:41 +00:00
Hannes Bornö
4eb55d0ff6
Use details tag in collapsed call stacks (#45907)
Currently the collapsed frameworks uses a `<button>` and React to
show/hide the frames in the error overlay. This change utilizes the
native `<details>` tag instead to achieve the same behaviour.

The default `<details>` arrow is hidden to preserve the same look:

![image](https://user-images.githubusercontent.com/25056922/218769518-fc5ad1ef-fa1a-4d18-8027-adb24b870089.png)

Fixes NEXT-546

## 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-02-14 16:31:59 -08:00
Hannes Bornö
cd76968621
Fix flaky rsc-build-error test (#45896)
Seems like a full reload was made in the test due to a runtime error
which made it flaky.

[slack
ref](https://vercel.slack.com/archives/C04DUD7EB1B/p1676314015291299)

## 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-02-14 13:49:35 -08:00
LongYinan
946ccb00fc
Update turbopack to 230209.02 (#45776)Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
# New Features
- https://github.com/vercel/turbo/pull/3540
- https://github.com/vercel/turbo/pull/3549
- https://github.com/vercel/turbo/pull/3465
- https://github.com/vercel/turbo/pull/3550
- https://github.com/vercel/turbo/pull/3495
- https://github.com/vercel/turbo/pull/3624
- https://github.com/vercel/turbo/pull/3600
- https://github.com/vercel/turbo/pull/3676
- https://github.com/vercel/turbo/pull/3689

# Fixes

- https://github.com/vercel/turbo/pull/3437
- https://github.com/vercel/turbo/pull/3542
- https://github.com/vercel/turbo/pull/3531
- https://github.com/vercel/turbo/pull/3552
- https://github.com/vercel/turbo/pull/3551
- https://github.com/vercel/turbo/pull/3597
- https://github.com/vercel/turbo/pull/3644
- https://github.com/vercel/turbo/pull/3623
- https://github.com/vercel/turbo/pull/3634
- https://github.com/vercel/turbo/pull/3574
- https://github.com/vercel/turbo/pull/3673
- https://github.com/vercel/turbo/pull/3675
- https://github.com/vercel/turbo/pull/3723
- https://github.com/vercel/turbo/pull/3677
- https://github.com/vercel/turbo/pull/3717
- https://github.com/vercel/turbo/pull/3701

# Performance Improvements

- https://github.com/vercel/turbo/pull/3361 
- https://github.com/vercel/turbo/pull/3619

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-02-10 17:40:19 +01:00
Hannes Bornö
7f28195dc4
Improve client-only imported in external package error (#45484)
Currently if an external package imports `'client-only'` it's difficult to figure out why the error occured. This change adds an explanation of which import caused the error.

The errors in the images are from using `<style jsx>` in a Server Component.

Before, runtime error on the server
![image](https://user-images.githubusercontent.com/25056922/216080617-9eebf99e-2899-4d7e-80b6-ef7ded0831ce.png)

After, webpack error with added stack trace
![image](https://user-images.githubusercontent.com/25056922/216303311-05c2f3ca-2857-4fe7-b55c-caaccf5f46bb.png)


Fixes NEXT-409

## 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-02-07 19:56:03 +00: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
Hannes Bornö
e3ed2f27e1
Add editor links to module import traces (#45257)
Makes it possible to open the files in module import traces in your editor by clicking them.

Module not found:
![image](https://user-images.githubusercontent.com/25056922/214539916-a776fa6f-7645-49c8-9106-a2abd62a8447.png)

Parse error:
![image](https://user-images.githubusercontent.com/25056922/214539987-0e3fd312-7ade-44fc-a334-b95d73320775.png)

Fixes NEXT-422

## 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-02-04 00:41:01 +00:00
Hannes Bornö
06b6aa2fa4
Error when exporting AMP config in app dir (#45228)
Errors in app-render if an exported amp config is found.

Fixes NEXT-223

## 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-02-02 23:37:05 +00:00
Hannes Bornö
8aa42519f3
Reload on server component change (#45268)
If there's an error when hard navigating to a page, the overlay in `packages/react-dev-overlay` is rendered instead of the one in `next`. This can cause you to get stuck if it's a server component because currently `packages/react-dev-overlay` ignores server component change events. This adds a reload for this case. The next step is probably to make sure the `app` overlay is rendered for errors during hard navigations as well.

## 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-02-02 14:58:39 +00:00
Hannes Bornö
9e290f9f15
Enable more hydration error overlay tests (#45404)
## 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-30 18:50:54 +00:00
Hannes Bornö
72baaebb92
Move error recovery test to new file (#45407) 2023-01-30 09:00:08 -08:00
JJ Kasper
5f937d6eaa
Update flakey polyfills and acceptance tests (#45313)
x-ref:
https://github.com/vercel/next.js/actions/runs/4015096851/jobs/6896473744
x-ref:
https://github.com/vercel/next.js/actions/runs/4015096851/jobs/6896483400
2023-01-26 10:25:47 -08:00
Hannes Bornö
018208fb15
Add editor links to RSC build error (#45179) 2023-01-24 15:13:37 -08:00
Hannes Bornö
7d00e362d2
Show component stack in error overlay on hydration error (#45089) 2023-01-24 11:12:29 +01:00
Derek Tissaw
05d887dc3b
Fix error overlay links in parenthesis (#45155)
Fixes https://github.com/vercel/next.js/issues/38362

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-01-23 20:09:11 -08:00
Jiachi Liu
e6ff749aee
Fix React.lazy preloading during SSR (#45160)
## Bug

Previously the `React.lazy` and Loadable preloading are creating different module loading promises with loader. Now we change to wait the loader in `React.lazy` to make sure for SSR case they're preloaded. The case to trigger this bug is: When adding `Document.getInitialProps` (aka. gIP), rendering goes to process the gIP first which would make the lazy elements executed before gIP, then preloading will happen after lazy which leads to Suspense resolves too fast without content.

Fixes #45151

- [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-01-23 22:13:37 +00:00
Jiachi Liu
e33e46d950
Fix dynamic no ssr with babel transform (#45091) 2023-01-23 13:39:47 -08:00
Tim Neutkens
9f9c9ea807
Add support for node: prefix when importing Node.js builtin modules (#45149)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-01-23 14:16:35 +01:00
JJ Kasper
9db8145858
Update swc_core to v0.56.0 (#44792)
Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
2023-01-20 10:34:09 -08:00
Hannes Bornö
0faedd9e1e
Fix error when CSS @import fails to resolve (#45010) 2023-01-19 14:43:32 -08:00
Hannes Bornö
9b39c79d2c
Display the reason of hydration error in error overlay (#44857) 2023-01-19 13:45:34 +01:00
Hannes Bornö
c50641f709
Remove next-app-loader from import trace (#44996) 2023-01-18 14:52:39 -08:00
JJ Kasper
4dfe831bbb
Add project directory rename/remove handling (#44911) 2023-01-18 14:37:40 -08:00
JJ Kasper
034ee8ac8b
Update some flakey acceptance tests (#44984) 2023-01-17 13:14:43 -08:00
Hannes Bornö
d45d0f96f5
Custom RSC compiler error message in pages/ (#44865)
Change the error message when the RSC compiler errors are caused by a
`/pages` page.
 
Fixes NEXT-371

## 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-16 14:47:18 +01:00
JJ Kasper
d5a188de06
Update test env variable passing (#44912) 2023-01-15 23:20:16 -08:00
JJ Kasper
ef9a152b57
Remove extra styled-components disabled test (#44870) 2023-01-13 16:26:33 -08:00
OJ Kwon
3e88af428c
test(snapshot): allow snapshot test not invalidate with --turbo (#43545) 2023-01-13 12:02:44 -08:00
Hannes Bornö
0b36a526c7
Fix capitalization in formatted server errors (#44798) 2023-01-12 08:15:28 -08:00
Hannes Bornö
ee0f483159
Migrate basic-basepath tests into basic (#44776)
Removes `test/development/basic-basepath` and migrates those tests into
`test/development/basic` instead. Currently the tests are duplicated but
`/basic-basepath` is just a subset of `/basic`.

## 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-11 08:13:19 -08:00
Hannes Bornö
9a5c8cebf0
Improve errors caused by Class Component rendered in a server component. (#44726)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-01-10 14:47:20 +01:00
Hannes Bornö
03e5f5e18d
Hydration error link is appended multiple times in app-dir (#44741)
It looks like we get the same error each time when React is retrying. This adds a check so the link is only appended the first time.

Before
![image](https://user-images.githubusercontent.com/25056922/211514056-d34ab8bc-65ec-42ea-a891-ca1ce5fd07de.png)

After
![image](https://user-images.githubusercontent.com/25056922/211514266-181b8fd4-cc72-42c9-b3fb-53cb6a326fee.png)

Fixes NEXT-356

## 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-10 10:33:24 +00:00
Tobias Koppers
3b91ca98a3
hmr error improvements (#30616)
Co-authored-by: Hannes Bornö <hannes.borno@vercel.com>
Co-authored-by: Hannes Bornö <borno.hannes@gmail.com>
2023-01-06 20:35:16 +01:00
Hannes Bornö
8b99e06e30
Improve errors caused by Next.js client hook called in a server component (#44588)
Throws if any of the Next.js client hooks are used in a server component in DEV.

```
Error: useSearchParams only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component
```

Fixes NEXT-287

## 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-06 02:21:56 +00:00
JJ Kasper
d40daaa197
Update flakey styled-components test (#44613)
x-ref:
https://github.com/vercel/next.js/actions/runs/3850826647/jobs/6561463849
2023-01-05 15:57:58 -08:00
Hannes Bornö
d89bdb2b0c
Improve errors caused by client hook called in a server component (#44538)
Improve errors caused by client hook called in a server component.

Before
![image](https://user-images.githubusercontent.com/25056922/210399932-02d1071c-0d06-4260-8f1d-7da436e8bca9.png)


After
![image](https://user-images.githubusercontent.com/25056922/210399817-f949fb14-2f81-4309-bfcb-27af38ea1329.png)

Fixes NEXT-311

## 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-04 11:01:50 +00:00
Hannes Bornö
29106f47ac
Collapse sequences of call stack frames from React and Next.js in the error overlay (#44137)
Sequences of call stack frames from React or Next.js are collapsed, most
of the time these just adds noise to the error overlay. The collapsed
stack frames can be expanded though by clicking them.

Adds the package of the stack frame to the
`'/__nextjs_original-stack-frame'` response, so we can figure out if the
stack frame is from React/Next.js in the error overlay.

<details>
<summary>View before/after</summary>

## Before

![image](https://user-images.githubusercontent.com/25056922/208419557-73af3864-c4e8-4d78-92de-5d2cdf772f33.png)

## After

![image](https://user-images.githubusercontent.com/25056922/208419729-f7f8d0d1-dea9-48cf-8a74-6fca3f0d027b.png)

## Another error, React expanded

![image](https://user-images.githubusercontent.com/25056922/208419977-c608f8ea-ddf9-40b1-ae87-49e6929ee959.png)
</details>


## 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-03 14:47:58 -08:00
Hannes Bornö
4a9dc11235
Test server component error recovery in dev (#44155)
Test that server components can recover from syntax and component error.

## 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-03 12:45:50 +01:00
Tim Neutkens
9ee4c0cdf1
Enable allowMiddlewareResponseBody by default (#44224)
Follow-up to #44195


## 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-12-21 18:40:58 +00:00
Jan Kaifer
f07f69dd0f
Add test checking that repeated edits won't cause hydration issues (#44189) 2022-12-21 14:17:50 +01:00
Jiachi Liu
2f0b5a282e
Also check error.message as digest for recoverable errors in pages (#44185)
Follow up for #44161

According to https://github.com/facebook/react/pull/25313, the `errorInfo.digest` will be moved to `error.digest`, but for now we use it as a fallback for pages. we can remove it later once the migration is done in required react version for nextjs

## 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-12-20 14:44:30 +00:00
Hannes Bornö
39f30fbdb4
Remove browser.refresh in app tests (#44186) 2022-12-20 14:37:55 +01:00
Hannes Bornö
9203386f91
Enable ReactRefreshLogBox scss test (#44180)
## 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-12-20 09:18:13 +00:00
JJ Kasper
19013a5e3f
Ensure next.url is used instead of next.appPort (#44163)
`appPort` shouldn't be used unless absolutely necessary as `next.url` is
more specific and allows more control.

x-ref:
https://github.com/vercel/next.js/actions/runs/3734223762/jobs/6336069606
2022-12-19 13:29:50 -08:00
Tim Neutkens
7a2ec41601
Refactor more tests to createNextDescribe (#44104) 2022-12-19 10:20:01 +01:00
Hannes Bornö
04c2509daa
Fast refresh should recover from event handler errors in app dir (#43882)
Component state should not be lost due to a full reload after an error occurs in an event handler. Only do a full reload if an error was caught by the error overlay error boundary.

Closes NEXT-182

## 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-12-13 04:48:18 +00:00
Jiachi Liu
8e04398343
Erase dynamic ssr:false imports on server (#43974)
Fixes #43895

There's a `is_server_components` condition introduced in #42426 but it's
always truthy so the `ssr:false` is not erased properly. Then in #42589
the flag is removed but also the optimization is removed as well. This
PR reverts the unexpected change removed in #42589 to keep the removal
for client dynamic imports on server side. Add tests to keep there's no
trace

## 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-12-12 14:32:54 -08:00
Hannes Bornö
45eea0a57e
Open server component errors fullscreen (#43887)
https://github.com/vercel/next.js/pull/43844 continued.

Make sure Server Component errors always open in fullscreen mode. Currently they only open in fullscreen on initial load - not when adding an Error when updating the file.

If in test env, call `self.__NEXT_HMR_CB` after server component HMR was successful, used in tests for the error overlay.

Closes NEXT-202

## 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-12-12 12:27:06 +00:00
Hannes Bornö
f6f1f50238
Increase stack trace limit on the server (#43800)
Increases `Error.stackTraceLimit` on the server to match the client.
Adds `if (typeof window !== 'undefined') {` in `use-error-handler`,
otherwise it also affects the server - but only after that file is
compiled.

Closes NEXT-125

 ### Before

![image](https://user-images.githubusercontent.com/25056922/206123948-0c92009a-e5e8-4519-9862-1c1b83d88168.png)

### After

![image](https://user-images.githubusercontent.com/25056922/206124053-ba792463-76d4-457c-ac3b-d3e5b95b7bf9.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)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-12-11 22:35:55 -06:00
JJ Kasper
6ba53d8f1f
Update flakey dev context tests (#43951)
x-ref:
https://github.com/vercel/next.js/actions/runs/3672193364/jobs/6208192356
x-ref:
https://github.com/vercel/next.js/actions/runs/3672193364/jobs/6208192142
x-ref:
https://github.com/vercel/next.js/actions/runs/3672172302/jobs/6208150047
2022-12-11 21:43:08 -06:00
Hannes Bornö
50caf8b191
Add helpful error for createContext used in Server Components (#43747)
Format runtime server errors similarly to how build errors [are
formatted](https://github.com/vercel/next.js/blob/canary/packages/next/client/dev/error-overlay/format-webpack-messages.js).
Add helpful message when createContext is used in Server Components.

## 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-12-11 20:46:29 -06:00
OJ Kwon
f144c39ca4
build(cargo): bump up swc_core, turbopack (#43652)
<!--
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

Fixes WEB-166.

This supersedes https://github.com/vercel/next.js/pull/43449, updating
swc_core and turbopack both with its transitive dependencies. Version
bump includes one important build side issues to having circular
dependencies.
2022-12-08 12:58:48 -08:00
Hannes Bornö
98cb2547cd
Unhandled errors and rejections opens as minimized in app dir error overlay (#43844)
Updated version of the reverted https://github.com/vercel/next.js/pull/43511

Unhandled errors that did not occur during React rendering (those errors are caught in `getDerivedStateFromError` in the Error Overlay) should be opened in the minimized toast state instead of fullscreen. For example if they occur in event handlers or setTimeout. Errors that breaks the app, such as uncaught render errors or build errors, still opens up in fullscreen mode.

The added test make sure the errors opens up as minimized, but if there's a breaking error it should "win" and open up in fullscreen. The updated tests either throw errors inside an event handler or a setTimeout, or the error is handled in a custom error boundary - which means the app don't break.

Closes NEXT-128

## 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-12-08 11:30:27 +00:00
Hannes Bornö
738de0164f
Remove __webpack_exports__ from error overlay (#43715) 2022-12-07 11:50:39 +01:00
JJ Kasper
992c46e63b
Update flakey app logbox test (#43682)
x-ref:
https://github.com/vercel/next.js/actions/runs/3611458418/attempts/2
x-ref:
https://github.com/vercel/next.js/actions/runs/3611458418/attempts/1
x-ref:
https://github.com/vercel/next.js/actions/runs/3611571327/jobs/6086144720
2022-12-03 20:24:49 -08:00
JJ Kasper
90f022aeb6
Update test config (#43661)
Updates our test config to take advantage of more concurrency and also
updates to leverage the playwright docker image to reduce flakes from
actions/setup-node stalling or playwright dependencies stalling on `apt
install`.

This reduces our test times from upwards of 30 minutes down to back
around 15 minutes.
2022-12-03 19:49:00 -08:00
Hannes Bornö
d41afd7152
Revert: 'Minimized runtime errors in app dir' (#43648)
Reverts: #43511

It incorrectly shows render errors minimized although it should only be
for uncaught errors/rejections. Keep old behaviour for now.

## 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-12-02 20:51:23 +01:00
Hannes Bornö
b2dd167eaa
Minimized runtime errors in app dir (#43511)
Currently when there's a runtime error - the error overlay opens up in
full screen mode. In app it should open in the minimized state.

Build errors will still have to open up in full screen since the app
will not be runnable due to it being broken.

Before

![image](https://user-images.githubusercontent.com/25056922/204551137-5a72c4b9-5340-49d7-8369-9087a7830732.png)

After

![image](https://user-images.githubusercontent.com/25056922/204550919-503a0dc5-1c36-4965-818e-c97e455f73bf.png)


Fixes #43460

## 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-30 20:37:48 -08:00
Hannes Bornö
cd8a1a4be5
Remove stack trace from full reload warning (#43453)
Adds a new error link with possible ways to fix the cause of the full reload. Removes the stack trace and adds the file causing the error to the message.

Before
![image](https://user-images.githubusercontent.com/25056922/204278894-dd773e6d-9d79-459a-abc4-243c1b22b206.png)

After:
![image](https://user-images.githubusercontent.com/25056922/204278538-5e26a174-bae4-457f-aac4-f239398227f8.png)

Fixes #43448

## 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-28 13:18:26 +00:00
Tim Neutkens
d40ecb7f3f
Resolve RSC / HTML rendering errors in error overlay (#43332) 2022-11-25 13:06:42 +01: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
OJ Kwon
edba9396a8
test(dev): support to run test with --turbo (#41908)
<!--
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:
-->

This PR updates test fixture setup to pass `--turbo` when devserver is
initiated. Due to lot of existing tests are not working with turbopack
yet, changes are focused to setup necessary logics for the fixtures
only. With this change we can create some sort of burndown list to fix
forward.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-26 22:56:18 -07:00
Jiachi Liu
20f5db06fa
Update precompiled react to next channel (#41708)
Precompile `react@next` and to unlock `cache` and `use` API
2022-10-24 00:31:52 -07:00
Tim Neutkens
9dae7a89d0
Enable ReactRefreshLogBox-builtins.test.ts, remove loader from import trace (#41645) 2022-10-22 14:26:57 +02:00
Tim Neutkens
b6cfeebf13
Refactor hot-reloader client for app (#41598)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-10-22 09:56:48 +02:00
Balázs Orbán
422ccb98b8
fix: allow user directory with styled-jsx prefix in next dev (#41484)
Fixes #41476, ref #40679

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-10-19 19:01:48 +00:00
Tim Neutkens
f260328900
BREAKING CHANGE: Enable newNextLinkBehavior (#41459)
- Enable newNextLinkBehavior. See #36436 
- Run next/link codemod on test suite

Note that from when this lands on apps trying canary will need to run
the new-link codemod in order to upgrade.
Ideally we have to detect `<a>` while rendering the new link and warn
for it.

Co-authored-by: Steven <steven@ceriously.com>
2022-10-17 21:20:28 -04:00
Hannes Bornö
e5be49eec1
Font loader with babel error (#41151)
Adds build error when using font loaders with babel. Otherwise you'll
get other unrelated errors.

## 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 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-10-05 22:14:31 -07:00
Donny/강동윤
3f2fef19bc
chore: Update swc_core to v0.28.10 (#41016)
This PR updates swc crates to 447e2449d9
2022-09-29 14:09:20 +00:00
Hannes Bornö
f662f18159
Fix flaky full reload hmr tests (#40786)
The issue seems to be that ` await check(() =>
browser.elementByCss('p').text(), 'hello world!!!')` sometimes tries to
get `.text()` from the DOM before the full reload and it times out.

## 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 lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-09-22 08:56:42 -07:00
Hannes Bornö
bf8ee1edb4
Add support for font loaders (#40746)
For some context:
[https://vercel.slack.com/archives/CGU8HUTUH/p1662124179102509](https://vercel.slack.com/archives/CGU8HUTUH/p1662124179102509)

Continuation of #40221 and #40227

Adds `experimental.fontLoaders`.

SWC next-font-loaders (#40221) transforms font loader (e.g. #40227) call
expressions into an import with the function call arguments as a query.

The imports will be matched by `next-font-loader`. It runs the
configured font loaders - emits font files and returns CSS. Exports are
added, and the font-family is made locally scoped. The returned CSS is
turned into a CSS module with `css-loader` which lets you consume the
font-family.

`FontLoaderManifestPlugin` creates a manifest of the preloaded font
files for each entrypoint. Preload/preconnect are then added in
`_document.tsx` if any font files were found for that path.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-09-21 22:12:59 -07:00
Donny/강동윤
57be012e06
chore: Update swc (#40520)
This updates SWC crates to
69bf533571

---

 - Closes https://github.com/vercel/next.js/issues/40535

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-09-15 14:22:11 +02:00
Hannes Bornö
6fb1121e8c
Add missing trace for full reload event (#40393)
Added missing trace for `client-full-reload` event in hot reloader. Full
reload tests moved to hmr, think they make more sense there than on
their own.
2022-09-09 13:09:15 -07:00
JJ Kasper
c89e25eba6
Update flakey tsconfig test (#40105)
Updates this test to not rely on `waitFor` as the amount of time it takes to write the `tsconfig.json` can vary so we should use `check` instead. 

Fixes: https://github.com/vercel/next.js/pull/39902#issuecomment-1231939162
2022-08-30 12:31:38 -05:00
Jiachi Liu
8668020a54
Upgrade typescript to 4.8.2 (#39979)
Typescript published 4.8.2 today and it fails CI, bump our typescript version to 4.8.2 and tweak some typings to make existing e2e typescript tests work properly

* Bump web-vitals from 3.0.0-beta to 3.0.0 stable for typing fix (there's an undefined type but it wasn't caught by ts 4.7), also force compiled it as CJS for pre-compiled
* Bump ncc to 3.34.0 for ts-loader compatibility for new typescript version, ncc 3.33.x cannot work with ts 4.8
* Update pre-compiled
2022-08-29 16:56:02 +00:00
JJ Kasper
f6c96e05c0
Fix incorrect build log for moduleResolution (#39991)
Removes extra log shown when checking `moduleResolution` in
`tsconfig.json` and adds regression test.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-08-26 19:05:12 -05:00
Jiachi Liu
7397be7792
test: pin typescript version to 4.7 (#39978)
Typescript published 4.8 and the ts tests are filling. Fix it by pining it to 4.7 temproraily 

x-ref: https://github.com/vercel/next.js/runs/8037717851?check_suite_focus=true#step:9:211
2022-08-26 16:59:33 +02:00
JJ Kasper
08dd08ec72
Skip auto-install for missing deps in CI (#39882)
Follow-up to https://github.com/vercel/next.js/pull/39838 this skips auto-installing missing TypeScript dependencies in CI environments as this creates a side-effect which we want to avoid. 

x-ref: [slack thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1661301586792559?thread_ts=1661299706.559769&cid=C03KAR5DCKC)

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-08-23 22:53:05 -05:00
JJ Kasper
ec25b4742b
Add handling for auto installing TypeScript deps and HMRing tsconfig (#39838)
This adds handling for auto-detecting TypeScript being added to a project and installing the necessary dependencies instead of printing the command and requiring the user run the command. We have been testing the auto install handling for a while now with the `next lint` command and it has worked out pretty well. 

This also adds HMR handling for `jsconfig.json`/`tsconfig.json` in development so if the `baseURL` or `paths` configs are modified it doesn't require a dev server restart for the updates to be picked up. 

This also corrects our required dependencies detection as previously an incorrect `paths: []` value was being passed to `require.resolve` causing it to fail in specific situations.

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

### `next build` before

https://user-images.githubusercontent.com/22380829/186039578-75f8c128-a13d-4e07-b5da-13bf186ee011.mp4

### `next build` after


https://user-images.githubusercontent.com/22380829/186039662-57af22a4-da5c-4ede-94ea-96541a032cca.mp4

### `next dev` automatic setup and HMR handling

https://user-images.githubusercontent.com/22380829/186039678-d78469ef-d00b-4ee6-8163-a4706394a7b4.mp4


## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [x] Errors have helpful link attached, see `contributing.md`
2022-08-23 13:16:47 -05:00
JJ Kasper
611e13f515
Fix disposing active entries in dev compilers (#39845)
As noticed in https://github.com/markdoc/markdoc/issues/131 it seems we are incorrectly disposing active entries causing HMR to fail after the configured `maxInactiveAge`. To fix this instead of only updating lastActiveTime for one compiler type's entry we update all active compiler types for the active entry. 

This also updates an existing test to catch this by waiting the `maxInactiveAge` before attempting a change that should trigger HMR. 

## Bug

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

Fixes: https://github.com/markdoc/markdoc/issues/131
2022-08-23 07:23:43 +00:00
JJ Kasper
31bcd044ff
Ensure moduleResolution is written correctly (#39836)
This removes the usage of `Node12` from the `parsedValues` for `moduleResolution` as this caused false detection of `undefined` being a valid value when it was removed in TypeScript. This also copies over the test from https://github.com/vercel/next.js/pull/37302 to ensure we don't regress on this. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/37296
Closes: https://github.com/vercel/next.js/pull/37302
2022-08-22 18:36:36 -05:00
Aniket Singh Rawat
8ddcc6aedb
Fix removing whitespacing in dev overlay (#28277)
## Bug

- [x] Related issues linked using `fixes #number`

fixes #14434 

Before
![image](https://user-images.githubusercontent.com/31622972/130001431-392efc66-69b3-47b5-802a-251a545983fd.png)

After
![image](https://user-images.githubusercontent.com/31622972/130001455-f553c977-c64b-43da-8e27-b513c6ea4179.png)



Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-08-08 02:16:42 +00:00
Severin Ibarluzea
dce8c0ce9d
fix(#11930): rewritten api routes can correctly handle cors in dev mode (#38937)
* fix(#11930): rewritten api routes can correctly handle cors in dev mode

* test that request matches hot reloader middleware instead of api https://github.com/vercel/next.js/pull/38937#pullrequestreview-1055957698

* remove unnecessary imports

* remove unused constant

* remove api route import
2022-07-29 21:39:43 -05:00
Javi Velasco
14463ddd10
Update Edge Runtime (#38862)
This PR updates the Edge Runtime to use a new version that loads dependencies differently. This addresses https://github.com/vercel/next.js/pull/38766 so `instanceof` works as expected.

It involved a few code changes, mostly regarding to types. The most important change is that the `Runner` function in the sandbox doesn't take a `ReadableStream` as `body` anymore since this implies creating the instance on "node land" and makes the runtime `fetch` function not to be able to compare with `ReadableStream` using `instanceof`.  Instead we introduce a "clonable body" abstraction that allows to create the `ReadableStream` from `Readable` by using the edge runtime primitive which would hold the correct prototype.

Also, this PR changes the way we pre-compile the Edge Runtime to adapt it to the new version.
2022-07-21 18:29:19 +00:00
Hannes Bornö
469c5030ba
Display stack trace when error occurs in API route (#38289)
## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-07-05 21:33:58 +00:00
Leah
95449e6632
feat: enable styled-components css prop swc transform by default (#37962) 2022-06-23 18:08:22 +00:00
Leah
7c20918bc7
feat: enable configuration of styled-components transform and enable css prop support (#37861)
This allows configuring / overriding the default options of the `styled-components` swc transform and allows using the `css` prop support, which was already implemented, but not available.

Edit: made the CSS prop transform run before the display name, so it gets picked up by that and receives the (deterministic) name.

Relates to #30802
2022-06-23 16:55:05 +00:00
Hannes Bornö
2ff660c25a
Remove full reload overlay and warn in CLI instead (#37874)
- Always perform a full reload when needed without blocking with the overlay.
- Old client warnings re-added.
- Post client warning to dev server and print it in the CLI. 


## 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 `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-06-22 15:41:23 +00:00
JJ Kasper
d8bfa7b112
Fix compile time log after error (#37863) 2022-06-21 11:04:57 +02:00
Hannes Bornö
2313ee093a
Display full refresh warning even when error has occurred (#37425)
If you end up in a state where an error happened and you also should be warned about a full refresh  - you get stuck. The full refresh is blocked by the warning but the error is shown instead.

Tests didn't catch this because the refresh warning never showed in `__NEXT_TEST_MODE`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-06-19 00:00:14 +00:00
John Pham
be5dedf676
Allowing hiding the ReactDevOverlay (#37417)
* Add hide button

* Update label

* Add data attributes for testing

* Add e2e tests

* update test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-06 14:21:53 -04:00
Motoki saito
b4089f3732
improve getStaticProps error message (#34287)
* improve getStaticProps error message

* Revert "improve getStaticProps error message"

This reverts commit 60544afac1e971d62f3273e2b5600d8b28d94764.

* apply suggestion

* rm .only

* update test

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-22 16:50:21 -05:00
await-ovo
ff37cc9e13
fix: should listen for config file changes when specifying the app directory (#36570)
Fixes: #36569 



## Bug

- [x] Related issues linked using `fixes #number`
- [x] 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-05-22 19:42:53 +00:00
LongYinan
33c837b115
Stabilize SWC emotion transform plugin (#37058) 2022-05-21 04:09:30 +00:00
JJ Kasper
6e40fbd495
Ensure hydration error doc link is shown with react 18 (#37074)
Follow-up to https://github.com/vercel/next.js/pull/31519 this ensures the error link we added is shown with react 18 as well. 

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`
2022-05-20 19:04:27 +00:00
Damien Simonin Feugas
bf089562c7
feat(middleware)!: forbids middleware response body (#36835)
_Hello Next.js team! First PR here, I hope I've followed the right practices._

### What's in there?

It has been decided to only support the following uses cases in Next.js' middleware:
- rewrite the URL (`x-middleware-rewrite` response header)
- redirect to another URL (`Location` response header)
- pass on to the next piece in the request pipeline (`x-middleware-next` response header)

1. during development, a warning on console tells developers when they are returning a response (either with `Response` or `NextResponse`).
2. at build time, this warning becomes an error.
3. at run time, returning a response body will trigger a 500 HTTP error with a JSON payload containing the detailed error.

All returned/thrown errors contain a link to the documentation.

This is a breaking feature compared to the _beta_ middleware implementation, and also removes `NextResponse.json()` which makes no sense any more.

### How to try it?
- runtime behavior: `HEADLESS=true yarn jest test/integration/middleware/core`
- build behavior : `yarn jest test/integration/middleware/build-errors`
- development behavior: `HEADLESS=true yarn jest test/development/middleware-warnings`

### Notes to reviewers

The limitation happens in next's web adapter. ~The initial implementation was to check `response.body` existence, but it turns out [`Response.redirect()`](https://github.com/vercel/next.js/blob/canary/packages/next/server/web/spec-compliant/response.ts#L42-L53) may set the response body (https://github.com/vercel/next.js/pull/31886). Hence why the proposed implementation specifically looks at response headers.~
`Response.redirect()` and `NextResponse.redirect()` do not need to include the final location in their body: it is handled by next server https://github.com/vercel/next.js/blob/canary/packages/next/server/next-server.ts#L1142

Because this is a breaking change, I had to adjust several tests cases, previously returning JSON/stream/text bodies. When relevant, these middlewares are returning data using response headers.

About DevEx: relying on AST analysis to detect forbidden use cases is not as good as running the code.
Such cases are easy to detect:
```js
new Response('a text value')
new Response(JSON.stringify({ /* whatever */ })
```
But these are false-positive cases:
```js
function returnNull() { return null }
new Response(returnNull())

function doesNothing() {}
new Response(doesNothing())
```
However, I see no good reasons to let users ship middleware such as the one above, hence why the build will fail, even if _technically speaking_, they are not setting the response body. 



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

- [x] Make sure the linting passes by running `yarn lint`
2022-05-19 22:02:20 +00:00
Shu Ding
be9491e243
Ensure there is only 1 render pass in concurrent rendering with getInitialProps in _document (#36352)
This PR makes sure `renderPage` calls `renderShell` in concurrent features, and `renderToString` if not.

Closes #36268, #36229.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] 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-04-21 16:01:47 +00:00
await-ovo
864d401ee1
fix(next): use moduleGraph.getIssuer to avoid deprecation warning (#36329) (#36330)
fix: #36329 



## 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`
2022-04-21 14:14:03 +00:00
残月
9fe2f2637c
feat:Add support for useDefineForClassFields typescript option (#36335)
* feat:Add support for useDefineForClassFields typescript option

* test:add test for useDefineForClassFields option

* test: fix lint error
2022-04-21 10:41:09 +02:00
JJ Kasper
b5d9ce5559
Add client HMR tracing for debugging (#36328)
This adds client HMR event tracing to help debug the client state for reproductions easier
2022-04-21 08:30:23 +00:00
JJ Kasper
bf405c38eb
Ensure error is cleared for missing global css (#36292)
This ensures we strip ansi encoding from serialized errors as it causes the error to be illegible when rendered. This also adds a test for global CSS import being missing and then fixed. 

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-04-20 12:03:48 +00:00
Donny/강동윤
16f7084e7f
feat(next-swc): Update swc crates (#35996)
* Move

* Adjust

* publish = false

* Tree

* Move tests

* fixup

* Split `emotion`

* Split `styled_jsx`

* Split `styled_jsx`

* fmt

* `--fix`

* clippy

* Update crates

* fixup

* publish

* Bump

* Rename

* authors

* Update

* More update

* Oh

* Update test refs

* Update test refs

* Update again

* Fix
2022-04-11 11:59:16 +02:00
John Daly
9110b5a4f1
Emotion SWC Plugin - Allow for jsxImportSource to be configurable (#35963)
* Allowing the jsxImportSource to be configurable when using the Emotion SWC plugin

* Adding test case

* Addressing PR feedback

* Moving getEmotionOptions call back to where it was previously

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-04-07 14:33:38 +02:00
JJ Kasper
4a7ab34baf
Update repo to use react 18 by default (#35888)
This updates our `yarn next` command to leverage react v18 by default and removes the need for the test require hook/config modifying when testing react 18. There are some fixtures we need to investigate react 18 support in follow-ups:

- `test/integration/client-navigation-a11y`
- `test/integration/critical-css`
- `test/integration/custom-error-page-exception`
- `test/integration/font-optimization`
- AMP specific tests
2022-04-05 21:51:47 +00:00
JJ Kasper
e148d2bdbd
Continue testing react v17 with e2e tests (#35787)
* Continue testing react v17 with e2e tests

* update react 17 expected error

* Update env variable name and add log

* fix starter cache version

* remove extra setup condition

* Revert "remove extra setup condition"

This reverts commit 5760a9f8867213f95a9fac073fe27a9ec01b780f.

* update basepath test

* remove log

* stabilize test
2022-03-31 17:35:00 -05:00
JJ Kasper
d95aed607c
Fix router isReady and react 18 not being detected with no config (#35762)
This fixes `router.isReady` being incorrect in dev mode due to the `isAutoExport` field being false from `hasConcurrentFeatures` being flagged similar to the static 404 in https://github.com/vercel/next.js/pull/35749. While investigating this I also noticed we aren't properly detecting react 18 when no `next.config.js` is present. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/35754
x-ref: https://github.com/vercel/next.js/pull/35749
2022-03-31 02:11:00 +00:00
JJ Kasper
fe012ff916
Fix document styles with react 18 (#35760)
This is a follow-up to https://github.com/vercel/next.js/pull/35736 that ensures we use the styles from `_document.getInitialProps` instead of only applying the `styled-jsx` styles. 

## Bug

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

Fixes: https://github.com/vercel/next.js/issues/35758
x-ref: https://github.com/vercel/next.js/pull/35736
2022-03-31 00:35:00 +00:00
Donny/강동윤
fdfa3c7bae
feat(next-swc): Update swc crates (#35395)
* Update crates

* fixup

* fix type

* Update test refs

* Update css crates

* Update test refs

* Update test refs

* Update test refs

* SourceMap

* Fix?

* Update crates

* Fix

* Update test refs

* Update test refs

* Update error reporter

* Update snapshots

* Update snapshots

* Bug?

* Fix

* Fix lint

* Update swc again

* fixup

* Update test refs

* Fix

Co-authored-by: Maia Teegarden <dev@padmaia.rocks>
2022-03-30 15:13:40 -07:00
JJ Kasper
050936c040
test(fix: Prevent page to scroll to top during data HMR) (#35744)
* fix: Prevent page to scroll to top during data HMR

* Add test for scroll position with gssp refreshing
2022-03-30 11:20:50 -05:00
Shu Ding
600e0b3e4e
Fix _document and getInitialProps with React 18 (#35736)
* wip

* update test

* fix _document logic for edge runtime and rsc

* revert deleted file

* fix lint error

* fix

* remove doc gip test

* Revert "remove doc gip test"

This reverts commit a5fd1d7e58463b8dd92df111bc2ae71a34224ad1.

* fix test

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2022-03-30 11:10:48 -05:00
Tim Neutkens
62bb3482fe
Fix Fast Refresh for React 18 (#35718)
- Updates the React 18 test suite to the latest React version.
- Upgrade `react-refresh` module

Fixes #35518
Fixes #35703

## 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: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
2022-03-30 12:16:17 +00:00
LongYinan
2e16d02faa
SWC emotion transform plugin (#34687) 2022-03-15 08:51:15 +01:00
Balázs Orbán
728d82663c
feat: allow dotenv default expansion (#34765)
We currently use `dotenv-expand@5` in `@next/env`, which does not support default expansion. It was added in v6 (https://github.com/motdotla/dotenv-expand/pull/39).

Upgrading to the latest version of `dotenv-expand` and fixing an import, the added test passed.

Fixes #34718

## 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-03-03 16:52:20 +00:00
JJ Kasper
59714db16d
Update server-only changes HMR handling (#34298)
* Update server-only changes HMR handling

* Add failing tests for GS(S)P server only changes

* update test

* normalize backslashes

* Update to xor the chunk hashes

* remove test change

* remove other test change
2022-02-16 16:32:24 -06:00
Balázs Orbán
9639fe704c
Ensure we don't poll page in development when notFound: true is returned (#34352)
Fixes: #34342

Visiting the following page will call gSSP indefinitely in a loop and logs errors from `on-demand-entries-client`:
```js
const Home = () => null
export default Home
        
export function getServerSideProps() {
  console.log("gssp called")
  return { notFound: true }
}
```

We should not keep fetching the page if it returns 404 as  it can introduce unnecessary data requests.

## Bug

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



Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-02-16 18:53:48 +00: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
Balázs Orbán
7e95e30063
fix: allow certain variable names in development (#33638)
Fixes #24570

A few variable names (listed https://github.com/vercel/next.js/issues/24570#issuecomment-828721019) were causing problems when using `next dev`.

## 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 14:22:35 +00: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
JJ Kasper
57a87050e7
Add util for normalizing errors (#33159)
* JSON.stringify generic errors

* Add util for normalizing errors

* lint-fix

* Add better error for null case as well

Co-authored-by: Michael Ozeryansky <mozeryansky@users.noreply.github.com>
2022-01-11 14:40:03 -06:00
JJ Kasper
52cf7fe51e
Ensure setImmediate and punycode are polyfilled (#32768)
* Ensure setimmediate and punycode are polyfilled

* update compiled
2022-01-03 13:31:23 -06:00
Michiel Van Gendt
d7062dddcc
Include message body in redirect responses (#31886)
# Description

The redirect responses do not contain a message body. This is in conflict with the RFCs (below) and causes Traefik (a reverse proxy) to invalidate the responses. In this pull request, I add a response body to the redirect responses. 

This PR is similar to https://github.com/vercel/next.js/pull/25257, it appears that there are some other locations where redirection is handled incorrectly in next.js.

# References
- https://datatracker.ietf.org/doc/html/rfc7230#section-3.3

> All 1xx (Informational), 204 (No Content), and 304 (Not Modified) responses must not include a message-body. All other responses do include a message-body, although the body may be of zero length.

- https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.3

> The server's response payload usually contains a short hypertext note with a hyperlink to the different URI(s).

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2021-12-16 05:41:43 +00:00
Tobias Koppers
ee220730db
fixes to allow lazy compilation for import() (#32441) 2021-12-14 11:33:04 +01:00
Tim Neutkens
c1a1aa4ae2
Add test for TailwindCSS JIT mode reloading (#32130)
Test for https://github.com/tailwindlabs/tailwindcss/discussions/6265 

Issue started with https://github.com/vercel/next.js/pull/31798



## 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-04 21:59:32 +00:00
Tobias Koppers
b79591cdaf
simplify output messages (#31454)
remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used.
2021-11-16 15:57:30 +00:00
JJ Kasper
be03a1d17b
Remove .only and ensure jest lint rules apply for all tests (#31456) 2021-11-15 12:46:12 -06:00
Tim Neutkens
e0531e30f4
Add support for legacy decorators through tsconfig/jsconfig (#31376) 2021-11-13 18:26:13 +01:00
Tim Neutkens
a4692d400d
Add support for jsxImportSource in tsconfig/jsconfig (#31358) 2021-11-12 21:51:43 +01:00
Tim Neutkens
b5b315ae04
Add test for styled-components SWC transform disabled (#31214)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-11-09 17:18:04 +01:00
Donny/강동윤
54ca8f41ce
next-swc: Add displayNameAndId of styled-components (#31189)
## 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`




Related to: https://github.com/vercel/next.js/issues/30802
2021-11-09 10:05:31 +00:00
Tim Neutkens
08a7f7f31a
Enable SWC by default when there is no custom Babel config (#29811)
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
Co-authored-by: Maia Teegarden <dev@padmaia.rocks>
Co-authored-by: padmaia <padmaia@users.noreply.github.com>
2021-10-23 10:21:44 +02:00
Tobias Koppers
0f453c06e2
improve CI stability (#30171) 2021-10-22 12:35:38 +02:00
Tobias Koppers
be2156f634
fix pageKey and compiling output for on-demand-entries (#30116)
shows `compiling /_error...` instead of `compiling /next/dist/pages/_error...`
2021-10-21 10:52:50 +00:00
Tobias Koppers
8bce51d8a9
avoid showing empty Import trace for requested module (#30130)
## Bug

- [ ] Related issues linked using `fixes #number`
- [x] 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-21 10:07:02 +00:00
JJ Kasper
800b2beef6
Remove docker usage for running development tests (#29264) 2021-09-21 19:04:23 +02:00
JJ Kasper
0976a04e8c
Temporarily disable unreliable tests (#29249) 2021-09-21 16:23:48 +02:00
JJ Kasper
a92a5caec2
Update test set-up to leverage playwright when able to (#28634)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-13 14:36:25 +02:00