In fact in my IDE, the "require" is always underlined in red: TS2591 cannot find name 'require'...
And when the application run, it fails because flexsearch is just an empty object and so i cannot call create function.
Any clue ?
I've tried to add this property in tsconfig.json but still a failure : "esModuleInterop": true
const FlexSearch = require('flexsearch');
@Injectable()
export class Cites {
// didn't find a way to specify type Index ?
protected index;
public constructor() {
const index = FlexSearch.create({
// mandatory:
encode: (str) => str,
// optionally:
rtl: false,
stemmer: {},
// matcher: {},
filter: false,
tokenize: 'strict',
depth: 3,
doc: {
id: 'id',
field: ['cite', 'author']
}
});
}
Each time i get this error:
ERROR Error: Uncaught (in promise): TypeError: flexsearch__WEBPACK_IMPORTED_MODULE_5___default.a.create is not a function
TypeError: flexsearch__WEBPACK_IMPORTED_MODULE_5___default.a.create is not a function
I've also tryed another way:
import FlexSearch from 'flexsearch';
This time the FlexSearch is not undefined, but it's an empty object...
Hi,
i'm trying to import this library into Angular (v11). I've read the docs and also this issue https://github.com/nextapps-de/flexsearch/issues/196 without any success.
Angular 11 is delivered with:
Here is my tsconfig.json:
In fact in my IDE, the "require" is always underlined in red: TS2591 cannot find name 'require'... And when the application run, it fails because flexsearch is just an empty object and so i cannot call create function. Any clue ? I've tried to add this property in tsconfig.json but still a failure :
"esModuleInterop": true
Each time i get this error:
I've also tryed another way:
import FlexSearch from 'flexsearch';
This time the FlexSearch is not undefined, but it's an empty object...Thanks for help,