### Why?
When users want to hide the dev indicator, they might be frustrated if
it reappears every reload. Hence, make a default to hide it for the
current server session or a day.
Closes NDX-890
---------
Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
The static indicator was added in the new dev overlay but wasn't hooked up to pages router. This wires that up so they're properly marked static/dynamic.
Closes NDX-897
Currently when you select "Hide Dev Tools", if an error comes in you
won't see the error indicator anymore.
This follows the same treatment as when the indicator is disabled in
next config, which is to only show you errors, and not the regular
indicator/popover.
- Moved source files from `_experimental/` to `ui/`.
- Moved `dev-indicators` sources out of `internal/`.
- Renamed files and variables to have explicit `app-`, `App`, `pages-`
or `Pages` prefixes for better distinguish.
- Updated snapshots that were caused by the name change.
- Added better type to `next-runtime.webpack-config.js`.
- Moved `font/` out of `ui/`.
---------
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Jimmy Lai <laijimmy0@gmail.com>
When you forget to export a component in the layout, the error message
points you to the page component, which is confusing.
This ensures the error points to the module that's missing the export.
Closes NDX-874
This PR removed the old overlay including the deprecated `buildActivity`
and `appIsrStatus` options.
Closes NDX-785
Closes NDX-855
Closes NDX-865
Closes NDX-866
Closes NDX-867
Closes NDX-868
Fix font loading from a non-root URL:
Repro:
```
pnpm next dev test/development/app-dir/owner-stack/
```
and Visit http://localhost:3000/browser/uncaught
Shows
```
GET /browser/__nextjs_font/geist-latin.woff2 404 in 330ms
```
### What?
Two issues need to be solved:
1. Font isn't working. Dev overlay uses Geist fonts. Currently does not
work if they are not installed in OS.
2. Even if fonts worked, we would be downloading fonts from Google for
the dev overlay, which is not ideal for slow internet & users with
restricted access to Google.
### Why?
**Reason to (1):** Styles defined inside Shadow DOM cannot contain
`@font-face`. Custom fonts should be defined in the main container and
can be accessed in Shadow DOM. Read this
[post](https://robdodson.me/posts/at-font-face-doesnt-work-in-shadow-dom/).
### How?
To solve (1), we simply lift the font styles outside the Shadow DOM.
To solve (2), we introduce a new dev middleware for the dev-server that
serves the font assets & we modify the taskfile to move the woff2 fonts
to the dist folder.
Closes NDX-834
### What?
When you enable both Turbopack, and the new dev overlay, you will see
that the dev overlay is frozen and the network tab shows that it is
fetching the stack frames API indefinitely.
### Why?
During our migration to the new development overlay, we implemented a
refactor to ensure that logic for handling runtime errors is executed
consistently, even in the case of build-time errors. This change
involves invoking the getErrorByType function for build errors. However,
this function attempts to retrieve stack frames for the build-time
error, inadvertently triggering Turbopack to initiate a rebuild.
Once Turbopack completes the rebuild process, it dispatches a Hot Module
Replacement (HMR) event to indicate the presence of a new error. This
event prompts getErrorByType to attempt fetching the stack frames again,
which in turn causes Turbopack to rebuild once more. This creates an
endless loop of rebuilding and error signaling.
You can repro it by running
```
__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY='true' TURBOPACK=1 pnpm testonly-dev test/development/acceptance-app/editor-links.test.ts
```
with the test file change in this PR. (Important to add that. Otherwise
the test would still complete successfully)
### How?
Do not run the runtime error logic for build errors.
Closes NDX-816
- `newDevOverlay: true` by default (enables experimental React builds on
canary until owner stacks progress further)
- `run-tests` now sets the env var for tests that were relying on it for
forking behavior
- PPR runners now run with the flag disabled to help catch regressions
in the old overlay until we remove it
- Fixed a number of tests that had outdated snapshots or missed forking
behavior because they weren't running in CI
- Disabled a test that was failing in Turbopack + Experimental React
that is unrelated to the overlay (see:
https://github.com/vercel/next.js/pull/75989)
---------
Co-authored-by: devjiwonchoi <devjiwonchoi@gmail.com>
Most functions in `next/cache` don't work on the client, and produce
confusing error messages when called there. It's better to just ban them
at compile time.
NOTE: For legacy/compat reasons, we're allowing `unstable_cache` and
`unstable_noStore`, since they don't currently throw when called.
The `--no-mangling` CLI option for `next build` was originally
introduced in #42633. However, we lost this feature during our migration
from Terser to SWC. As part of broader improvements for debugging
dynamic accesses with Dynamic I/O enabled, I needed this functionality
back, so I restored it for Webpack and also added it to Turbopack.
fixes#67037fixes#50208
---------
Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
### What
Addressing the hack we introduced in #71483, where we always display the
hydration error with squashed hydration info into the first error. Now
we're displaying the errors with its own corresponding hydration info
properly, so we don't have to order it in a certain place, but just test
the displayed error itself.
Closes NDX-484
### What
We should treat each line's first character to determine the leading
sign, rather than treating the trimed line's first character as sign.
The bad case was the close tag `>` was treated as leading error sign
```
> <p // should be treated as errored line ✅
> // should not be treated as errored line ❌
```
Also align the attribute name for highlighted lines
We weren't rendering the new indicator when used in pages router -- `isMounted` was only true when there was an error. This PR keeps the `isMounted` logic for the old overlay but removes it for the new one.
This seems to fix at least some cases of `called Option::unwrap() on a None value`.
I suspect this is because of the eventual consistency model in dev?
It also adds better error messages for the various situations.