Skip to content

Commit 89336e4

Browse files
conico974vicb
andauthored
Fix and enhancement for Next 16 (#1029)
* fix build and bump next version * make page router build * fix app router * fix app-pages-router * fix e2e locally * handle segments during cache generation * fix segment data prefetching with default Next * Make segment prefetching works with cache interception * linting * fix interceptor * changeset * review fix * bump to 20 * some fix for flaky e2e test * review * fixup! lock file 16.0.1 --------- Co-authored-by: Victor Berchet <[email protected]>
1 parent c5b24f7 commit 89336e4

File tree

32 files changed

+330
-207
lines changed

32 files changed

+330
-207
lines changed

.changeset/thirty-bears-tell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/aws": minor
3+
---
4+
5+
Add support for Next 16

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Install's node, pnpm, restores cache, and then installs dependencie
33

44
inputs:
55
node-version:
6-
default: 18.x
6+
default: 20.x
77
registry-url:
88
default: "https://registry.npmjs.org"
99

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
uses: actions/setup-node@v4
9797
with:
9898
cache: pnpm # cache pnpm store
99-
node-version: 18.18.2
99+
node-version: 20.x
100100

101101
- name: Install packages
102102
run: pnpm install

examples/app-pages-router/next.config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import type { NextConfig } from "next";
33
const nextConfig: NextConfig = {
44
poweredByHeader: false,
55
cleanDistDir: true,
6-
transpilePackages: ["@example/shared"],
76
output: "standalone",
8-
// outputFileTracingRoot: "../sst",
9-
eslint: {
10-
ignoreDuringBuilds: true,
11-
},
127
trailingSlash: true,
138
skipTrailingSlashRedirect: true,
149
};
File renamed without changes.

examples/app-pages-router/open-next.config.local.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export default {
2929
},
3030
loader: "fs-dev",
3131
},
32+
dangerous: {
33+
enableCacheInterception: true,
34+
},
3235
// You can override the build command here so that you don't have to rebuild next every time you make a change
33-
//buildCommand: "echo 'No build command'",
36+
// buildCommand: "echo 'No build command'",
3437
} satisfies OpenNextConfig;

examples/app-pages-router/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"openbuild": "node ../../packages/open-next/dist/index.js build --build-command \"npx turbo build\"",
77
"openbuild:local": "node ../../packages/open-next/dist/index.js build --config-path open-next.config.local.ts",
8-
"openbuild:local:start": "PORT=3003 tsx proxy.ts",
8+
"openbuild:local:start": "PORT=3003 tsx on-proxy.ts",
99
"dev": "next dev --turbopack --port 3003",
1010
"build": "next build",
1111
"start": "next start --port 3003",

examples/app-pages-router/tsconfig.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"moduleResolution": "NodeNext",
1313
"resolveJsonModule": true,
1414
"isolatedModules": true,
15-
"jsx": "preserve",
15+
"jsx": "react-jsx",
1616
"incremental": true,
1717
"plugins": [
1818
{
@@ -23,11 +23,17 @@
2323
"@/*": ["./*"]
2424
}
2525
},
26-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26+
"include": [
27+
"next-env.d.ts",
28+
"**/*.ts",
29+
"**/*.tsx",
30+
".next/types/**/*.ts",
31+
".next/dev/types/**/*.ts"
32+
],
2733
"exclude": [
2834
"node_modules",
2935
"open-next.config.ts",
3036
"open-next.config.local.ts",
31-
"proxy.ts"
37+
"on-proxy.ts"
3238
]
3339
}

examples/app-router/app/api/after/revalidate/route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ export function POST() {
66
() =>
77
new Promise<void>((resolve) =>
88
setTimeout(() => {
9-
revalidateTag("date");
9+
revalidateTag("date", {
10+
// We want to expire the "date" tag immediately
11+
expire: 0,
12+
});
1013
resolve();
1114
}, 5000),
1215
),

examples/app-router/app/api/after/ssg/route.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import { NextResponse } from "next/server";
44
export const dynamic = "force-static";
55

66
export async function GET() {
7-
const dateFn = unstable_cache(() => new Date().toISOString(), ["date"], {
8-
tags: ["date"],
9-
});
7+
const dateFn = unstable_cache(
8+
async () => new Date().toISOString(),
9+
["date"],
10+
{
11+
tags: ["date"],
12+
},
13+
);
1014
const date = await dateFn();
1115
return NextResponse.json({ date });
1216
}

0 commit comments

Comments
 (0)