Skip to content

Bundler Support

Some bundlers require additional configuration to work with PGlite.

TIP

If you come across any issues with PGlite and a specific bundler, please open an issue, we'd also love any contributions to this bundler documentation if you're able to help out.

Vite

When using Vite, make sure to exclude pglite from dependency optimization using the optimizeDeps option inside vite.config.js:

js
import { defineConfig } from 'vite'

export default defineConfig({
  optimizeDeps: {
    exclude: ['@electric-sql/pglite'],
  },
})

Next.js

When using Next.js, make sure to add @electric-sql/pglite to the transpilePackages array in next.config.js:

js
const nextConfig = {
  swcMinify: false,
  transpilePackages: [
    '@electric-sql/pglite-react', // Optional
    '@electric-sql/pglite',
  ],
}

export default nextConfig