Closed Ak1r0 closed 10 months ago
Perhaps you can try the fllowing way:
import { createRequire } from 'node:module';
const Database = createRequire(import.meta.url)('better-sqlite3');
Perhaps you can try the fllowing way:
import { createRequire } from 'node:module'; const Database = createRequire(import.meta.url)('better-sqlite3');
Thanks for your answer ! But tbh by the time i did change a lot a things...
Like call new Database
in a function executed at very first usage. I figured out I had conception mistakes with the previous code. The new Database
call was done even before Electron app was ready.
Then with your answer i tried to reproduce and updated every package to last version +changes few things in nuxt.config.ts and electron-builder.json5 and now it's all working for me. Still I didn't really understand what was wrong...
Hi !
I've just upgrade from v4.5 to v5 and got this error when starting the app in dev mode (with
nuxt dev
cmd) : "Could not dynamically require "better_sqlite3.node" when upgrading from v4.5 to v5 (same error with v6). Reversing to v4.5 resolve the error.Any idea about the problem ?
Error details :
The error is thrown by the
new Database()
call in this code :