Update to NextJS 16

This commit is contained in:
Francisco Ignácio Fontoura Solla 2026-02-17 01:56:16 -03:00
parent 205b018bb4
commit 0e9dcceb83
7 changed files with 375 additions and 315 deletions

View file

@ -1,38 +1,20 @@
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import { FlatCompat } from '@eslint/eslintrc'
import { defineConfig, globalIgnores } from 'eslint/config'
import nextVitals from 'eslint-config-next/core-web-vitals'
import nextTs from 'eslint-config-next/typescript'
import prettier from 'eslint-config-prettier/flat'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
})
const eslintConfig = [
...compat.extends('next/core-web-vitals', 'next/typescript'),
{
rules: {
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^(_|ignore)',
},
],
},
},
{
ignores: ['.next/'],
},
]
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
prettier,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
'.next/**',
'out/**',
'build/**',
'next-env.d.ts',
]),
])
export default eslintConfig

View file

@ -2,16 +2,7 @@ import { withPayload } from '@payloadcms/next/withPayload'
/** @type {import('next').NextConfig} */
const nextConfig = {
// Your Next.js config here
webpack: (webpackConfig) => {
webpackConfig.resolve.extensionAlias = {
'.cjs': ['.cts', '.cjs'],
'.js': ['.ts', '.tsx', '.js', '.jsx'],
'.mjs': ['.mts', '.mjs'],
}
return webpackConfig
},
cacheComponents: true,
}
export default withPayload(nextConfig, { devBundleServerPackages: false })

View file

@ -26,7 +26,8 @@
"devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
"generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap",
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
"lint": "cross-env NODE_OPTIONS=--no-deprecation eslint --cache --cache-location .next/cache/eslint/",
"lint:fix": "cross-env NODE_OPTIONS=--no-deprecation eslint --fix",
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
"test": "pnpm run test:int && pnpm run test:e2e",
@ -42,28 +43,33 @@
"cross-env": "^7.0.3",
"dotenv": "16.4.7",
"graphql": "^16.8.1",
"next": "15.4.11",
"next": "^16.1.6",
"payload": "3.76.1",
"react": "19.2.1",
"react-dom": "19.2.1",
"sharp": "0.34.2"
"react": "^19.2.4",
"react-dom": "^19.2.4",
"sharp": "0.34.2",
"tailwindcss-animate": "^1.0.7",
"tw-animate-css": "^1.4.0"
},
"devDependencies": {
"@next/eslint-plugin-next": "^16.1.6",
"@playwright/test": "1.58.2",
"@tailwindcss/postcss": "^4.1.18",
"@testing-library/react": "16.3.0",
"@types/node": "22.19.9",
"@types/react": "19.2.9",
"@types/react-dom": "19.2.3",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "4.5.2",
"eslint": "^9.16.0",
"eslint-config-next": "15.4.11",
"eslint": "^9.39.2",
"eslint-config-next": "^16.1.6",
"eslint-config-prettier": "^10.1.8",
"jsdom": "28.0.0",
"postcss": "^8.5.6",
"prettier": "^3.4.2",
"tailwindcss": "^4.1.18",
"tsx": "4.21.0",
"typescript": "5.7.3",
"typescript-eslint": "^8.55.0",
"vite-tsconfig-paths": "6.0.5",
"vitest": "4.0.18"
},
@ -77,5 +83,6 @@
"esbuild",
"unrs-resolver"
]
}
},
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
}

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,6 @@ import './styles.css'
import { RefreshRouteOnSave } from '@/utilities/RefreshRouteOnSave'
import { Metadata } from 'next'
import { getCachedGlobal } from '@/utilities/globals'
import { Media } from '@/payload-types'
import { getCachedDocumentById } from '@/utilities/documents'
export async function generateMetadata(): Promise<Metadata> {

View file

@ -1,5 +1,4 @@
import { revalidateGlobal } from '@/utilities/globals'
import { revalidateTag } from 'next/cache'
import type { GlobalConfig } from 'payload'
const slug = 'site-settings'

View file

@ -15,7 +15,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
@ -30,15 +30,16 @@
"./src/payload.config.ts"
]
},
"target": "ES2022",
"target": "ES2022"
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": [
"node_modules"
],
]
}