I must admit I am not an expert in imports and npm packaging.
in Vite 8 it seems the default import is not working as expected.
import createFuzzySearch from '@nozbe/microfuzz';
// createFuzzySearch() -----> is not a function error
// createFuzzySearch.default() ----> actual function but typescript complains about the typing.
My current workout is unkown casting
const microfuzz = (await import('@nozbe/microfuzz'))
.default as unknown as {
default: <T>(
list: T[],
options?: FuzzySearchOptions
) => FuzzySearcher<T>;
};
in my fix I am using a dynamic import, however, it does not matter, if it's dynamic or not.
My package json - machine/environment (relevant)
Windows - Node v24.11.1
"react": "19.2.4",
"react-dom": "19.2.4",
"typescript": "6.0.2",
"vite": "8.0.3"
tsconfig
I must admit I am not an expert in imports and npm packaging.
in
Vite 8it seems the default import is not working as expected.My current workout is unkown casting
in my fix I am using a dynamic import, however, it does not matter, if it's dynamic or not.
My package json - machine/environment (relevant)
Windows-Node v24.11.1tsconfig
{ "compilerOptions": { "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "target": "es2022", "useDefineForClassFields": true, "lib": ["ES2023", "DOM", "DOM.Iterable"], "module": "ESNext", "skipLibCheck": true, "allowArbitraryExtensions": true, "allowSyntheticDefaultImports": true, "allowJs": true, /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, "esModuleInterop": true, "isolatedModules": true, "moduleDetection": "force", "noEmit": true, "jsx": "react-jsx", /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true, "strictNullChecks": true, "noImplicitAny": true, "paths": { "src/*": ["./src/*"], "@styles/*": ["./styles/*"], "@components": ["./src/components/index.ts"], "@api": ["./src/api/index.ts"], "@hooks": ["./src/hooks/index.ts"], "@utils": ["./src/utils/index.ts"] } }, "include": ["./src"] }