Open imhalid opened 1 year ago
same problem :/
Same here, using vite
Internal server error: __vite_ssr_import_0__.default.create is not a function
same here
I think this is the same problem as #341. See my comment in #333 for an explanation.
import { Index } from 'flexsearch'
export function buildIndex(data) {
const index = new Index({
charset: 'latin:extra',
tokenize: 'full',
resolution: 9,
cache: true,
})
data.forEach((posts, i) => {
const pattern = posts.content
index.add(i, pattern)
})
return index
}
I solved my problem by doing it this way.
Whats the point of getting the best performance library which just can't work with ESM.
This is what i had to do to get it to work:
import Flexsearch from "flexsearch";
const Index= Flexsearch.Index ?? Flexsearch;
const index = Index({
tokenize: 'forward',
});
...
I want to add a search feature for a document project.
where am I making a mistake now