-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lowdb integration issues with typescript, next and jest #591
Comments
You should probably use the browser preset from here: https://github.com/typicode/lowdb/blob/main/src/examples/browser.ts Also, https://github.com/ncoquelet/lowdb_esm_issue is private |
I have try the browser preset but globaly I obtains the same issues. |
Got the same issue using Typescript, Webpack and node with ESM. Have you found any fix for this @ncoquelet? |
Nop, I'm using something else ... |
Surprisingly, TypeScript project references are not supported, so treat it as local folder package (see typicode/lowdb#591)
My workaround for NestJS - maybe it is useful for someone else as well: // use dynamic imports in combination with TS `moduleResolution: Node16` in ts config
const { JSONFilePreset } = await import("lowdb/node"); |
Hi,
I've been stuck for two days trying anything to add lowdb to my project, and this issue is my last chance.
This is a full ESM project using full Typescript and based on react, nextjs and jest.
I've created a repo that reproduce the problem by simplified the dependencies and customisation to avoid side effects.
https://github.com/ncoquelet/lowdb_esm_issue
Installation
Problems
Without lowdb everything works fine, but when I instantiate any lowdb class, I get these errors, both in next build and in the jest execution.
During Next build
full log
Jest Execution
full log
The text was updated successfully, but these errors were encountered: