mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## Add a regression test for when a not-found component depends on css and triggers a bug in turbopack To correctly serve js and css resources during server side rendering we construct a client manifest that lists all the server components and their required resources. Turbopack has a bug where we fail to collect css that is used by the page if it is also used by a not-found page (and other error handlers as well). When a not-found component is present all pages pages implicitly depend on this module and depend on it as an early dependency of the generated `app-page.js` file. This means if a `not-found.js` file (or a global error file) would happen to depend on the same css as a normal component we would associate it as a client-reference of that component instead of any other. Then on a server side render we would simply omit it. This PR adds a regression test for this issue. See #77861 and #79535
19 lines
479 B
TypeScript
19 lines
479 B
TypeScript
import styles from './styles.module.css'
|
|
|
|
/**
|
|
* The mere existence of a not found page importing the same css as a layout used to prevent it from being served.
|
|
*
|
|
* See https://github.com/vercel/next.js/issues/77861 and https://github.com/vercel/next.js/issues/79535
|
|
*/
|
|
export default function NotFoundPage() {
|
|
return (
|
|
<html lang="en">
|
|
<body className={styles.foo}>
|
|
<main>
|
|
<h1>Page not found</h1>
|
|
</main>
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|