Commit graph

3 commits

Author SHA1 Message Date
JJ Kasper
b3a7d9f030
Enable context caching for middleware/edge functions in dev (#47840)
As discussed this enables the context caching for the middleware/edge
functions sandbox in development which reduces execution time noticeably
as modules don't need to be re-processed for each request unless an HMR
event related to that context has occurred.

In a follow-up PR we can investigate spreading the middleware/edge
function invocations across workers/processes now that we have detached
rendering/invoke processes from the routing process.

<details>
	<summary>before</summary>

![CleanShot 2023-04-02 at 22 23
45@2x](https://user-images.githubusercontent.com/22380829/229419430-5eed36e9-2615-44be-9314-490cb7283e5b.png)

</details>

<details>
	<summary>after</summary>

![CleanShot 2023-04-02 at 22 24
41@2x](https://user-images.githubusercontent.com/22380829/229419472-822a2d16-7e0d-4ee8-99c2-b1211010ebcf.png)


</details>

x-ref: [slack
thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1677431214936269)
Fixes: https://github.com/vercel/next.js/issues/43999
2023-04-02 23:51:25 -07: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
Naoyuki Kanezawa
ea7efcb05c
fix(next): Do not display message when middleware is removed on dev mode (#39604)
Fixes https://github.com/vercel/next.js/issues/39532

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
2022-08-20 13:46:59 +00:00