Skip to content

Add @electric-sql/pglite to NonBundleablePackages #75

Open

Description

@orls0xF

PGlite locates pglite.data, pglite.wasm and initdb.wasm with new URL('./…', import.meta.url) and reads them from its own dist/ folder. When Nitro 3 bundles it, those files are not copied, and the first query fails:

ENOENT: no such file or directory, open '…/.output/server/_libs/pglite.data'

Repro with nitro 3.0.260903-beta (nf3 0.3.24), @electric-sql/pglite 0.5.8, Node 26:

// nitro.config.ts
import { defineConfig } from 'nitro'

export default defineConfig({ serverDir: './' })
// routes/index.ts
import { PGlite } from '@electric-sql/pglite'
import { defineHandler } from 'nitro/h3'

export default defineHandler(async () => (await new PGlite().query('select 1 as one')).rows)

nitro build, node .output/server/index.mjs, then GET / answers 500 with the error above.

With traceDeps: ['@electric-sql/pglite'] it answers [{"one":1}] (14 files traced, the data and wasm files included). PGlite's bundler docs expect some setup per bundler, so this is not a bug. But since the db already lists packages that cannot be bundled, could @electric-sql/pglite go in NonBundleablePackages, so it works without config? I can send a PR if that is the right list.

Activity

  1. pi0 commented on Oct 6, 2026

    @pi0
    Member

    pglite is wasm. i think we should actually make a PR to it's package to add unwasm condition for proper nitro compatibility instead of force tracing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions