typicode / lowdb

Simple and fast JSON database
MIT License
21.46k stars 922 forks source link

Want to use with NestJS #598

Open Neos21 opened 4 weeks ago

Neos21 commented 4 weeks ago

I want to use lowdb with NestJS. But lowdb is ESM, and NestJS is CommonJS. How to configure this?

tajnymag commented 4 weeks ago

According to many Nestjs discussions, the recommended way is to use Node v22+ and run your app with --experimental-require-module until it gets ported to stable Nodejs release.

Alternatively, if you don't need to access lowdb in constructor, import it with a dynamic import at the place you need.