'process is not defined' in Sveltekit SPA
Hi, I have a monorepo (turborepo) and I have my drizzle instance as a package. In my schema I have
Here is the code:
/// Database package:
packages\database\index.ts
packages\database\database.ts
packages\database\schema.ts
//// My Sveltekit app
The code lives in a component e.g.
Simply importing the create schema makes it pop the error. Any help is appreciated.
createInsertSchema I want to use in my frontend to do form validation. The problem is I get the error process is not defined because the code is ran from the client. In FF devtools I see it goes wrong at user: process.platform === 'win32' ? process.env.USERNAME : process.env.USER, (line 8 @ http://localhost:5173/node_modules/pg/lib/defaults.js). Why does it need pg in the first place? I only import the createInsertSchema.Here is the code:
/// Database package:
packages\database\index.ts
packages\database\database.ts
packages\database\schema.ts
//// My Sveltekit app
The code lives in a component e.g.
myForm.svelteSimply importing the create schema makes it pop the error. Any help is appreciated.