typicode / lowdb

Simple and fast JSON database
MIT License
21.49k stars 923 forks source link

[ERR_REQUIRE_ESM]: require() of ES Module #534

Closed dimaslanjaka closed 2 years ago

dimaslanjaka commented 2 years ago

how to deal with this error ?

iam using typescript commonjs

lowdb ^3.0.0 in package.json

luukdv commented 2 years ago

This seems to be a duplicate question (see https://github.com/typicode/lowdb/issues?q=is%3Aissue+ERR_REQUIRE_ESM).

You can check out this guide to solve it.

dimaslanjaka commented 2 years ago

aghhhh... migrating whole project to esm module?. impossible, many file typescripts that won't running in ESM module. (ive tried this) can i downgrade to non-ESM lowdb ? which latest version non-esm ?

typicode commented 2 years ago

version 1 is stable and non ESM

dimaslanjaka commented 2 years ago

done iam using version ^0.13.0

omar-dulaimi commented 2 years ago

Looks like a lot of us are using version 1.

U33r commented 2 years ago

I found this package. I don't know the safety of this package, but it seems that lowdb can be used with commonjs by using this package. https://www.npmjs.com/package/@commonify/lowdb