Open faribauc opened 3 months ago
i do not think this is a bug... i mean you are using an electron package inside of a node script that is called outside of electron.
just use your process.env.VITE_DATABASE_NAME || defaultDatabaseName in that file and when you init the db in your electron context override the name if not dev.
It is an issue because the electron
variable behaves differently when running in dev mode (missing the app
property) and when running in compiled mode. It has nothing to do with how I get the database name.
Also, I can't define the VITE_DATABASE_NAME on a customer computer. The db file needs to be created by the app, on launch, in the userData
directory. But that needs to happen only when running the compiled app, not in dev mode because in dev mode, the app
variable does not exist, and I can't get the userData
directory value. That is also the mode in which drizzle:generate
runs in within the electron project.
In this specific case, failing to check if electron.app
exists prior to check for isPackaged
is the exact issue.
I encountered a similar issue, although I wasn't using Drizzle in my application. In my case, the error was caused by the ELECTRON_RUN_AS_NODE
environment variable. When this variable is set, it forces Electron to use the Node.js version installed on your system instead of Electron's built-in Node.js runtime (link). Can you try unsetting it or was there a specific reason to do this? I tried looking into Electron's documentation about dev mode removing app
property, but seems like this is not the case.
Describe the bug
Hi!
I have an electron/drizzle app with the following config:
drizzle.config.ts
config.ts
When I run
drizzle:generate
I get the following error:I created PR #12 as a possible solution.
Any thoughts?
Electron-Toolkit Version
3.0.0
Electron Version
28.2.0
Validations