lowdb icon indicating copy to clipboard operation
lowdb copied to clipboard

Error [ERR_REQUIRE_ESM]: require() of ES Module from main.ts not supported.

Open kostia-lev opened this issue 5 months ago • 0 comments

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.

kostia-lev avatar Aug 25 '24 11:08 kostia-lev