payload.config.ts
import { buildConfig } from 'payload/config'
import { webpackBundler } from '@payloadcms/bundler-webpack'
import { mongooseAdapter } from '@payloadcms/db-mongodb'
import { slateEditor } from '@payloadcms/richtext-slate'
import path from 'path'
import { Users } from './collections/Users'
import dotenv from 'dotenv'
dotenv.config({
path: path.resolve(__dirname, '../.env'),
})
export default buildConfig({
serverURL: process.env.NEXT_PUBLIC_SERVER_URL || '',
collections: [Users],
routes: {
admin: '/sell',
},
admin: {
user: 'users',
bundler: webpackBundler(),
meta: {
titleSuffix: '- DigitalHippo',
favicon: '/favicon.ico',
ogImage: '/thumbnail.jpg',
},
},
rateLimit: {
max: 2000,
},
editor: slateEditor({}),
db: mongooseAdapter({
url: process.env.MONGODB_URL!,
}),
typescript: {
outputFile: path.resolve(__dirname, 'payload-types.ts'),
},
})
I'm encountering an issue with Webpack's PackFileCacheStrategy related to serialization. Upon using @payloadcms/bundler-webpack version 1.0.5, I'm receiving the following error:
[webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: No serializer registered for ConcatSource
- I expect the bundler to work without throwing the No serializer registered for ConcatSource error.
- I'm using @payloadcms/bundler-webpack version 1.0.5.
- Webpack's PackFileCacheStrategy is throwing an error related to serialization.
- This error occurs when I'm building the project with the specified configuration in payload.config.ts.
- I've also configured other Payload settings (collections, routes, bundler setup, editor options, etc.) as per the documentation.
Try to replace webpackBundler with viteBundler. (npm i @payloadcms/bundler-vite)