fix(web): restore serverExternalPackages for Payload + use --webpack for build
Root cause: Next.js 16 defaults to Turbopack for builds, but Payload CMS's richtext-lexical imports .css files that fail during route collection in Node ESM context. Fix: add @payloadcms/richtext-lexical and @payloadcms/next back to serverExternalPackages so Next.js skips their internal imports during route collection. Use --webpack explicitly since Turbopack production builds are incompatible with Payload (payloadcms/payload#14786). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -87,6 +87,8 @@ const config: NextConfig = {
|
|||||||
"payload",
|
"payload",
|
||||||
"@payloadcms/db-postgres",
|
"@payloadcms/db-postgres",
|
||||||
"@payloadcms/db-sqlite",
|
"@payloadcms/db-sqlite",
|
||||||
|
"@payloadcms/richtext-lexical",
|
||||||
|
"@payloadcms/next",
|
||||||
"sharp",
|
"sharp",
|
||||||
],
|
],
|
||||||
turbopack: {
|
turbopack: {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "next build",
|
"build": "next build --webpack",
|
||||||
"clean": "git clean -xdf .cache .next .turbo node_modules",
|
"clean": "git clean -xdf .cache .next .turbo node_modules",
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"format": "prettier --check . --ignore-path ../../.gitignore",
|
"format": "prettier --check . --ignore-path ../../.gitignore",
|
||||||
|
|||||||
Reference in New Issue
Block a user