Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions docs/getting-started/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ Payload requires the following software:

- Any JavaScript package manager (pnpm, npm, or yarn 2+ - pnpm is preferred, yarn 1.x is not supported)
- Node.js version 20.9.0+
- Next.js (one of the following version ranges):
- `15.2.9` - `15.2.x`
- `15.3.9` - `15.3.x`
- `15.4.11` - `15.4.x`
- `16.2.2`+
- Next.js `16.2.6`+
- Any [compatible database](/docs/database/overview) (MongoDB, Postgres or SQLite)

<Banner type="warning">
Expand Down
2 changes: 1 addition & 1 deletion examples/astro/payload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@types/node": "^22.5.4",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"eslint": "^9.16.0",
"eslint-config-next": "15.1.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@payloadcms/graphql": "latest",
"@swc/core": "^1.6.13",
"@types/ejs": "^3.1.5",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"eslint": "^8.57.0",
"eslint-config-next": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"devDependencies": {
"@swc/core": "^1.6.13",
"@types/ejs": "^3.1.5",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"eslint": "^8.57.0",
"eslint-config-next": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"devDependencies": {
"@types/express": "^5.0.0",
"@types/node": "^18.11.5",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"nodemon": "^3.1.7",
"ts-node": "^10.9.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/draft-preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@payloadcms/graphql": "latest",
"@swc/core": "^1.6.13",
"@types/escape-html": "^1.0.2",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"eslint": "^8.57.0",
"eslint-config-next": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@payloadcms/graphql": "latest",
"@swc/core": "^1.6.13",
"@types/ejs": "^3.1.5",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"eslint": "^8.57.0",
"eslint-config-next": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/form-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"@payloadcms/graphql": "latest",
"@types/node": "^20.11.25",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/live-preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@swc/types": "^0.1.6",
"@types/escape-html": "^1.0.2",
"@types/node": "^20.11.25",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/localization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@types/escape-html": "^1.0.2",
"@types/jsonwebtoken": "^9.0.6",
"@types/node": "22.5.4",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"autoprefixer": "^10.4.19",
"copyfiles": "^2.4.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/multi-tenant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"@payloadcms/graphql": "latest",
"@swc/core": "^1.6.13",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"eslint": "^8.57.0",
"eslint-config-next": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/remix/payload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@types/node": "^22.5.4",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"eslint": "^9.16.0",
"eslint-config-next": "15.1.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/tailwind-shadcn-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"devDependencies": {
"@tailwindcss/postcss": "^4.1.18",
"@types/node": "^20.11.25",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"autoprefixer": "^10.4.19",
"dotenv": "^16.4.5",
Expand Down
2 changes: 1 addition & 1 deletion examples/whitelabel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@payloadcms/graphql": "latest",
"@types/node": "^20.11.25",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"@axe-core/playwright": "4.11.0",
"@clack/prompts": "1.2.0",
"@libsql/client": "0.14.0",
"@next/bundle-analyzer": "16.2.3",
"@next/bundle-analyzer": "16.2.6",
"@payloadcms/db-postgres": "workspace:*",
"@payloadcms/eslint-config": "workspace:*",
"@payloadcms/eslint-plugin": "workspace:*",
Expand All @@ -175,7 +175,7 @@
"@types/fs-extra": "^11.0.2",
"@types/minimist": "1.2.5",
"@types/node": "22.15.30",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"@types/shelljs": "0.8.15",
"@vitest/ui": "4.1.2",
Expand All @@ -199,16 +199,16 @@
"lint-staged": "15.2.7",
"minimist": "1.2.8",
"mongoose": "8.15.1",
"next": "16.2.3",
"next": "16.2.6",
"node-gyp": "12.2.0",
"open": "^10.1.0",
"p-limit": "^5.0.0",
"pg": "8.16.3",
"postcss": "^8.4.49",
"postcss-scss": "^4.0.9",
"prettier": "3.5.3",
"react": "19.2.4",
"react-dom": "19.2.4",
"react": "19.2.6",
"react-dom": "19.2.6",
"rimraf": "6.0.1",
"sharp": "0.32.6",
"shelljs": "0.8.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"devDependencies": {
"@payloadcms/eslint-config": "workspace:*",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"payload": "workspace:*"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/live-preview-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"devDependencies": {
"@payloadcms/eslint-config": "workspace:*",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"payload": "workspace:*"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@
"@babel/preset-env": "7.27.2",
"@babel/preset-react": "7.27.1",
"@babel/preset-typescript": "7.27.1",
"@next/eslint-plugin-next": "16.2.3",
"@next/eslint-plugin-next": "16.2.6",
"@payloadcms/eslint-config": "workspace:*",
"@types/busboy": "1.5.4",
"@types/react": "19.2.9",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"babel-plugin-react-compiler": "19.1.0-rc.3",
"esbuild": "0.27.1",
Expand All @@ -144,7 +144,7 @@
},
"peerDependencies": {
"graphql": "^16.8.1",
"next": ">=15.2.9 <15.3.0 || >=15.3.9 <15.4.0 || >=15.4.11 <15.5.0 || >=16.2.2 <17.0.0",
"next": ">=16.2.6 <17.0.0",
"payload": "workspace:*"
},
"engines": {
Expand Down
49 changes: 14 additions & 35 deletions packages/next/src/withPayload/withPayload.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
* TypeScript compilation is not available. This ensures compatibility with all templates and
* user projects regardless of their TypeScript setup.
*/
import {
getNextjsVersion,
supportsServerFastRefreshConfig,
supportsTurbopackExternalizeTransitiveDependencies,
} from './withPayload.utils.js'
import { withPayloadLegacy } from './withPayloadLegacy.js'

const poweredByHeader = {
key: 'X-Powered-By',
Expand All @@ -22,11 +16,6 @@ const poweredByHeader = {
* @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false
* */
export const withPayload = (nextConfig = {}, options = {}) => {
const nextjsVersion = getNextjsVersion()

const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)
const hasServerFastRefreshConfigOption = supportsServerFastRefreshConfig(nextjsVersion)

const env = nextConfig.env || {}

if (nextConfig.experimental?.staleTimes?.dynamic) {
Expand All @@ -40,12 +29,6 @@ export const withPayload = (nextConfig = {}, options = {}) => {
env.PAYLOAD_CACHE_COMPONENTS_ENABLED = 'true'
}

if (nextjsVersion?.major === 16 && !hasServerFastRefreshConfigOption) {
console.warn(
'Payload: You are using an unsupported Next.js 16 version. You can find the supported Next.js versions here: https://payloadcms.com/docs/getting-started/installation',
)
}

const consoleWarn = console.warn

const sassWarningTexts = [
Expand All @@ -72,7 +55,7 @@ export const withPayload = (nextConfig = {}, options = {}) => {
experimental: {
...(nextConfig.experimental || {}),
// Server fast refresh breaks HMR
...(hasServerFastRefreshConfigOption ? { turbopackServerFastRefresh: false } : {}),
turbopackServerFastRefresh: false,
},
sassOptions: {
...(nextConfig.sassOptions || {}),
Expand Down Expand Up @@ -270,23 +253,19 @@ export const withPayload = (nextConfig = {}, options = {}) => {
baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath
}

if (!supportsTurbopackBuild) {
return withPayloadLegacy(baseConfig)
} else {
return {
...baseConfig,
serverExternalPackages: [
...(baseConfig.serverExternalPackages || []),
'drizzle-kit',
'drizzle-kit/api',
'sharp',
'libsql',
'require-in-the-middle',
'json-schema-to-typescript',
// Prevents turbopack build errors by the thread-stream package which is installed by pino
'pino',
],
}
return {
...baseConfig,
serverExternalPackages: [
...(baseConfig.serverExternalPackages || []),
'drizzle-kit',
'drizzle-kit/api',
'sharp',
'libsql',
'require-in-the-middle',
'json-schema-to-typescript',
// Prevents turbopack build errors by the thread-stream package which is installed by pino
'pino',
],
}
}

Expand Down
77 changes: 0 additions & 77 deletions packages/next/src/withPayload/withPayload.utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/**
* This was taken and modified from https://github.com/getsentry/sentry-javascript/blob/15256034ee8150a5b7dcb97d23eca1a5486f0cae/packages/nextjs/src/config/util.ts
*
Expand Down Expand Up @@ -105,79 +104,3 @@ export function getNextjsVersion() {
return undefined
}
}

/**
* Checks if the current Next.js version supports the `experimental.serverFastRefresh` option.
* This was introduced in Next.js v16.2.2
* @param {SemVer | undefined} version
* @returns {boolean}
*/
export function supportsServerFastRefreshConfig(version) {
if (!version) {
return false
}

const { major, minor, patch } = version

if (major === undefined || minor === undefined || patch === undefined) {
return false
}

if (major > 16) {
return true
}

if (major === 16) {
if (minor > 2) {
return true
}
if (minor === 2) {
return patch >= 2
}
}

return false
}

/**
* Checks if the current Next.js version supports Turbopack externalize transitive dependencies.
* This was introduced in Next.js v16.1.0-canary.3
* @param {SemVer | undefined} version
* @returns {boolean}
*/
export function supportsTurbopackExternalizeTransitiveDependencies(version) {
if (!version) {
return false
}

const { canaryVersion, major, minor, patch } = version

if (major === undefined || minor === undefined) {
return false
}

if (major > 16) {
return true
}

if (major === 16) {
if (minor > 1) {
return true
}
if (minor === 1) {
// 16.1.1+ and canaries support this feature
if (patch > 0) {
return true
}
if (canaryVersion !== undefined) {
// 16.1.0-canary.3+
return canaryVersion >= 3
} else {
// Next.js 16.1.0
return true
}
}
}

return false
}
Loading
Loading