Files
1482af898d [dev] Serve static metadata from filesystem (#83460)
Current metadata files are compiled to `route.js` files. This happens
not only to metadata API (e.g., `icon.tsx`), but to static files as
well, which is unnecessary. In development, this leads to confusing logs
such as:

```
Compiled /favicon.ico in ...ms
```

Users may reasonably wonder why Next.js is "compiling" a static file.

Static files can be served directly from the filesystem, like
`_next/static/` assets. Therefore, in development, skip compilation of
static metadata files and serve them as static.

For production, we can follow up in a separate PR to skip compiling the
`route.js` files and emit static files to the dist directory, and also
serve from the filesystem there as well.

Closes [NEXT-4338](https://linear.app/vercel/issue/NEXT-4338)

---

TODO(s) to follow up:

- Fix Cache Components failing build with metadata files inside the
dynamic route.
- x-ref: [slack
thread](https://vercel.slack.com/archives/C06N3AXRQ82/p1738053808940719)

---------

Co-authored-by: Jiachi Liu <[email protected]>
2025-09-10 14:25:41 +02:00
..