Skip to content
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

tsconfig with module option set to Node16 orama refuses to import #703

Open
gabrielsantosblanchet opened this issue Apr 18, 2024 · 1 comment

Comments

@gabrielsantosblanchet
Copy link

gabrielsantosblanchet commented Apr 18, 2024

Describe the bug

when using tsconfig option
"module": "Node16",
"moduleResolution": "Node16"
in a commonJS project orama refuses to import correctly

I'm using these option as per the documentation set in https://www.typescriptlang.org/docs/handbook/modules/reference.html#the-module-compiler-option

To Reproduce

the code will not work, as in it doesn't event compile

Expected behavior

since orama emits cjs file it should just be able to import the correct one

Environment Info

windows: 11
typescript: 5.4.3
node: v18.20.2
orama: 1.2.11

Affected areas

Environment/OS

Additional context

if needed I can provide more details when asked

@shubh2336
Copy link

Faced the same issue, got it working by dynamic import (as a workaround).

const searchFunction = async (data) => {
  return import("@orama/orama").then(async (module) => {
    const searchDB = await module.create({
      schema: { ... }
    });

    // Implement search logic below
  })
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants