You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using Flexsearch for a pretty long time now and it worked amazingly well. That is why I was so surprised when all my tests started to fail with the update to 0.7.43. I pulled down the branch and tried to run it locally. The first thing I noticed was that the build failed because I was doing the following:
import{Document}from"flexsearch";
I changed this to use a default exports as I can see in the source code that it is indeed exported as the default in document.js
importDocumentfrom"flexsearch";
However, with that, the following code triggers an error in the developer console:
React.useEffect(()=>{constjsonURL=process.env.REACT_APP_TESTING
? "/tools-test.json"
: "/tools.json";asyncfunctionfetchData(){constresponse=awaitfetch(jsonURL);consttools=awaitresponse.json();setTools(tools);constindex=newDocument({// <<-- THE ERROR IS THROWN HEREdocument: {index: ["tag",{field: "title",tokenize: "forward"}],},});tools.forEach((tool)=>{index.add(tool);});setToolsIndex(index);}fetchData();},[]);
Error
TypeError: flexsearch__WEBPACK_IMPORTED_MODULE_1__.default is not a constructor
Any idea why this is happening? I can see that the code in document.js uses new Document itself so curious as to why Webpack is mad. Thanks!
Update: I converted the project to Vite and I am still seeing the same error:
TypeError: Document is not a constructor
at fetchData (App.jsx:53:21)
The text was updated successfully, but these errors were encountered:
Hey All,
I have been using Flexsearch for a pretty long time now and it worked amazingly well. That is why I was so surprised when all my tests started to fail with the update to
0.7.43
. I pulled down the branch and tried to run it locally. The first thing I noticed was that the build failed because I was doing the following:I changed this to use a default exports as I can see in the source code that it is indeed exported as the default in
document.js
However, with that, the following code triggers an error in the developer console:
Error
Any idea why this is happening? I can see that the code in
document.js
usesnew Document
itself so curious as to why Webpack is mad. Thanks!Update: I converted the project to Vite and I am still seeing the same error:
The text was updated successfully, but these errors were encountered: