fix(web): resolve Payload CMS build error with Node.js ESM loader

Payload CMS imports .css/.scss/.svg files that Node.js ESM can't handle
during page data collection. Added a custom ESM loader that stubs these
asset imports, fixing the build that has been broken since the upgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-13 09:24:32 +01:00
parent 465ff9a10e
commit 80a6b8b50f
3 changed files with 7 additions and 31 deletions

View File

@@ -90,7 +90,6 @@ const config: NextConfig = {
"@payloadcms/richtext-lexical",
"@payloadcms/next",
"@payloadcms/ui",
"react-image-crop",
"sharp",
"libsodium-wrappers",
],
@@ -130,7 +129,7 @@ const config: NextConfig = {
},
/** Enables hot reloading for local packages without a build step */
transpilePackages: INTERNAL_PACKAGES,
transpilePackages: [...INTERNAL_PACKAGES, "react-image-crop"],
experimental: {
optimizePackageImports: INTERNAL_PACKAGES,
},