tsconfig with module option set to Node16 orama refuses to import
gabrielsantosblanchet opened this issue · comments
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
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
})
};