DenoDDeno
Powered by
vicaryV
Denoβ€’4mo ago
vicary

vite crashes on pg-types

When importing
npm:pg-types@^4.1.0
npm:pg-types@^4.1.0
during SSR, it fails with the following error.
TypeError: Cannot add property Encoder, object is not extensible
TypeError: Cannot add property Encoder, object is not extensible

It's caused by a common NPM max compat export pattern below in
postgres-bytea
postgres-bytea
.

Update
Found the solution before I can post this, sharing it here. Just add external to your vite.config.js.
export default defineConfig({
  plugins: [fresh(), tailwindcss()],
  ssr: {
    external: ["postgres-bytea"]
  }
});
export default defineConfig({
  plugins: [fresh(), tailwindcss()],
  ssr: {
    external: ["postgres-bytea"]
  }
});
stacktrace.txt1.88KB
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Deno+vite crashes on node dependency
DanielduelDDanielduel / help
3y ago
[Fresh] vite crashes with Broken Pipe error
vicaryVvicary / help
2mo ago
VSCode + Deno + Vite + Typescript
wilsonlewisWwilsonlewis / help
3y ago
Types on transitive dependencies
jfbnJjfbn / help
13mo ago