Payload has two official bundlers, the Webpack Bundler and the Vite Bundler. You must install a bundler to use the admin panel.

Install a bundler

Webpack (recommended):

yarn add @payloadcms/bundler-webpack

Vite (beta):

yarn add @payloadcms/bundler-vite
Configure the bundler
// payload.config.ts
import { buildConfig } from 'payload/config'
import { webpackBundler } from '@payloadcms/bundler-webpack'
// import { viteBundler } from '@payloadcms/bundler-vite'
export default buildConfig({
admin: {
bundler: webpackBundler() // or viteBundler()

What are bundlers?

At their core, a bundler's main goal is to take a bunch of files and turn them into a few optimized files that you ship to the browser. The admin UI has a root index.html entry point, and from there the bundler traverses the dependency tree, bundling all of the files that are required from that point on.

Since the bundled file is sent to the browser, it can't include any server-only code. You will need to remove any server-only code from your admin UI before bundling it. You can learn more about excluding server code section.


Excluding server-only code from admin UI