Vite fails to bundle node-postgres (pg
) properly when used with Cloudflare template
#9158
Labels
pg
) properly when used with Cloudflare template
#9158
Reproduction
Generate a remix site with the cloudflare template:
The site should deploy just fine. If you run
pnpm run build && pnpm run start
, it should serve up the remix bundle locally just fine. Then try to install prisma/postgres dependencies:create
app/db.server.ts
with the following contents:Create
prisma/schema.prisma
with the following contents:Put your db connection string into the environment variable
DATABASE_URL
. Generate the database withpnpx prisma migrate reset -f
. Then try to import the prisma client in your _index.tsx file withimport { prisma } from '~/db.server';
. Running db queries locally in dev mode (pnpm run dev
) works fine, but if you try to deploy to cloudflare or to run wrangler in dev mode, you'll get several errors that seem to have to do with thepg
adapter.Used Package Manager
pnpm
Expected Behavior
I expected to be able to bundle pg in vite/remix without errors.
Actual Behavior
I'm getting some sort of bundle error (detailed above).
The text was updated successfully, but these errors were encountered: