fix(web): upgrade next.js 16.0.10 → 16.2.2 (payload compat)
Some checks failed
CI / Lint (push) Has been cancelled
CI / Typecheck (push) Has been cancelled
CI / Broker tests (Postgres) (push) Has been cancelled
CI / Docker build (linux/amd64) (push) Has been cancelled

Payload CMS v3.81 withPayload() requires Next.js >=16.1.0 for
production turbopack builds. Upgrade resolves the build failure.

Reverts the dev-only withPayload workaround — now loads normally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-06 00:57:05 +01:00
parent 6b062ab239
commit 067ef10b70
3 changed files with 116 additions and 115 deletions

View File

@@ -1,17 +1,8 @@
import type { NextConfig } from "next";
import { withPayload } from "@payloadcms/next/withPayload";
import env from "./env.config";
// Payload CMS requires Next.js >=16.1.0 for production builds (turbopack).
// Until we upgrade from 16.0.10, load withPayload only in dev where
// turbopack isn't used for builds. Production serves blog/changelog
// as static pages — Payload admin is dev-only for now.
const withPayload =
process.env.NODE_ENV === "production"
? (c: NextConfig) => c
: // eslint-disable-next-line @typescript-eslint/no-require-imports
require("@payloadcms/next/withPayload").withPayload;
const INTERNAL_PACKAGES = [
"@turbostarter/analytics-web",
"@turbostarter/api",
@@ -125,4 +116,4 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: env.ANALYZE,
});
export default withPayload(withBundleAnalyzer(config)) as NextConfig;
export default withPayload(withBundleAnalyzer(config));