vicary
vicary3w ago

vite crashes on pg-types

When importing 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. 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"]
}
});
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?