TypeError: scrape_it_1.default is not a function
Closed this issue · 2 comments
divanvb commented
Not sure why I'm getting this error. If I replace the import statement with require it works. Any idea? I think it might be to do with the typings file?
scrapeIt(url, { title: '.mw-headline', });
IonicaBizau commented
Can you add an example?
AleTid5 commented
Hi! I know this bug is closed, but my answer may help someone in the future 🔮
When you have this kind of problems, always, the main reason is because you are trying to consume a Common JS dependency in an ES Module environment. In addition, this a very common problem when you are trying to consume a Common JS dependency using Typescript.
The way to solve it is adding in the tsconfig.json
file the next row "esModuleInterop": true
.
May I help someone some day!
Have a great scrapping 😄