Skip to content

Commit c562d4d

Browse files
committed
next13 async component + css modules repro
1 parent 6992569 commit c562d4d

File tree

9 files changed

+47
-94
lines changed

9 files changed

+47
-94
lines changed

app/layout.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default function RootLayout({ children }: { children: any }) {
2+
return (
3+
<html>
4+
<body>
5+
<header>header</header>
6+
<main>{children}</main>
7+
</body>
8+
</html>
9+
);
10+
}

app/loading.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Loading() {
2+
return <p>Loading...</p>;
3+
}

app/page.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import styles from "./styles.module.css";
2+
3+
export default async function Page() {
4+
// Artificially slow the page so we can see the loading state
5+
await new Promise<void>((res) => setTimeout(() => res(), 1000));
6+
7+
return <h2 className={styles.red}>hello world!</h2>;
8+
}

app/styles.module.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.red {
2+
color: red;
3+
}

next.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
const nextConfig = {
33
reactStrictMode: true,
44
swcMinify: true,
5+
experimental: {
6+
appDir: true,
7+
},
58
}
69

710
module.exports = nextConfig

pages/_app.tsx

Lines changed: 0 additions & 6 deletions
This file was deleted.

pages/api/hello.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

pages/index.tsx

Lines changed: 0 additions & 71 deletions
This file was deleted.

tsconfig.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"compilerOptions": {
33
"target": "es5",
4-
"lib": ["dom", "dom.iterable", "esnext"],
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
59
"allowJs": true,
610
"skipLibCheck": true,
711
"strict": true,
@@ -13,8 +17,20 @@
1317
"resolveJsonModule": true,
1418
"isolatedModules": true,
1519
"jsx": "preserve",
16-
"incremental": true
20+
"incremental": true,
21+
"plugins": [
22+
{
23+
"name": "next"
24+
}
25+
]
1726
},
18-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
19-
"exclude": ["node_modules"]
27+
"include": [
28+
"next-env.d.ts",
29+
"**/*.ts",
30+
"**/*.tsx",
31+
".next/types/**/*.ts"
32+
],
33+
"exclude": [
34+
"node_modules"
35+
]
2036
}

0 commit comments

Comments
 (0)