Closed kostia-lev closed 2 months ago
Strange error, you are using an ESM import, so no idea why it asks you for it. Consider trying this package: lowdb-js. It's a small personal adaptation for compatibility.
Strange error, you are using an ESM import, so no idea why it asks you for it. Consider trying this package: lowdb-js. It's a small personal adaptation for compatibility.
thank you for a reply. I found why. This https://github.com/electron-react-boilerplate/electron-react-boilerplate#readme boilerplate does not support latest versions of dependencies. I would need to downgrade version.
I use Electron and in main.ts: import { JSONFile } from 'lowdb/node'; import { Low } from 'lowdb';
app .whenReady() .then( () => new Low( new JSONFile<{ dogs: any; cats: string[] }>(
${app.getPath('userData')}/db.json
, ), { coins: [], accounts: {}, }, ), )I get error: Error [ERR_REQUIRE_ESM]: require() of ES Module from main.ts not supported. Instead change the require of node.js in main.ts to a dynamic import() which is available in all CommonJS modules.