You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using the pg package in a project. Recently, we get this error during build process:
error [vite]: Rollup failed to resolve import "cloudflare:sockets" from "/node_modules/pg-cloudflare/dist/index.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
Error: [vite]: Rollup failed to resolve import "cloudflare:sockets" from "/node_modules/pg-cloudflare/dist/index.js".
The thing is, we are not using cloudflare or cloudflare workers at all. I saw that the pg-cloudflare package is in the optional dependencies of the pg package. For whatever reason, node installs all optional dependencies by default. So I tried installing the packages without the optional dependencies.
But now there is this error:
✘ [ERROR] Could not resolve "pg-cloudflare"
node_modules/pg/lib/stream.js:10:41:
10 │ const { CloudflareSocket } = require('pg-cloudflare')
╵ ~~~~~~~~~~~~~~~
You can mark the path "pg-cloudflare" as external to exclude it from the bundle, which will remove
this error. You can also surround this "require" call with a try/catch block to handle this
failure at run-time instead of bundle-time.
What did I do wrong?
The text was updated successfully, but these errors were encountered:
Your client-side components shouldn’t be loading pg; even if you can get it to quietly import without errors, that’s a lot of unnecessary code served to clients.
We're using the
pg
package in a project. Recently, we get this error during build process:The thing is, we are not using cloudflare or cloudflare workers at all. I saw that the
pg-cloudflare
package is in the optional dependencies of thepg
package. For whatever reason, node installs all optional dependencies by default. So I tried installing the packages without the optional dependencies.But now there is this error:
What did I do wrong?
The text was updated successfully, but these errors were encountered: