#**Package better-sqlite3 with my electron app for Windows (Electron-Forge)
4 messages · Page 1 of 1 (latest)
I use better-sqlite3 in my app, but I use Drizzle ORM so I can probably only partially help you. When you make/package the application the path changes. So first you need to check if you are in production or development mode. You can do that by
import { app } from "electron";
const isProduction = app.isPackaged;
Then you need to set the paths for production and development. Here is a similar example of what you can do:
const sqlitePath = isProduction
? process.resourcesPath + "/sqlite"
: "sqlite";
Then in your forge.config.ts file:
const config: ForgeConfig = {
packagerConfig: {
asar: true,
extraResource: ["./sqlite"],
}, ...
Try this. I highly recommend using Drizzle ORM. I hope this helped
Hi @unkempt stirrup what exactly is the sqlitePath for you? I'm currently using better-sqlite3 + drizzle and facing a similar issue where it simply doesn't work in production.