mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
f80c92261e
This is about whether `new URL("logo.png", import.meta.url)` and `import logo from "./logo.png"` return a client or a server asset:
- a server asset is a file that will be read by the server during rendering, for example a Wasm or font file (if you think about vercel/og image generation). It's stored on the server next to the JS chunks
- a client asset is a file that will be used by the browser, e.g. for an `<img src={logo}/>` usecase. It will be stored on the CDN and have the `_next/` prefix.
For
- client contexts, it's easy: all imports are client assets (unsurprisingly)
- SSR contexts, we emulate the client (to prevent hydration mismatches)
- API/metadata context, it's less clear cut what should happen, but we arbitrarily do the following: `new URL` returns server assets and `import logo` returns client assets.
That very last case of having client assets for imports, and server assets for `new URL` wasn't implemented in Turbopack.
Turbopack doesn't change anything here fundamentally, but Webpack appears to have some bugs where this is less consistent (across nodejs/edge and api/metadata routes for example). See tests added in https://github.com/vercel/next.js/pull/84636
Closes PACK-4874
Closes PACK-5649
Closes #80577
8 lines
131 B
JavaScript
8 lines
131 B
JavaScript
export default function RootLayout({ children }) {
|
|
return (
|
|
<html lang="en">
|
|
<body>{children}</body>
|
|
</html>
|
|
)
|
|
}
|