cali
cali15mo ago

Importing cheerio

I'm trying to use cheerio, but I'm getting an error. 1. I use import * as cheerio from "cheerio"; 2. So when I try to use const $ = cheerio.load(body); 3. I'm getting the message: TypeError: cheerio.load is not a function. (In 'cheerio.load(body)', 'cheerio.load' is undefined) I'm probably doing something wrong, but what could it be?
3 Replies
cali
caliOP15mo ago
Additional info: I'm using Bun script.
Tiago Serafim
Tiago Serafim15mo ago
Some JS libs don't seem to work with Bun yet. In those cases, I try to find a Deno alternative. For cheerio, I've used this in the past https://deno.land/x/cheerio@1.0.7/mod.ts
cali
caliOP15mo ago
great! tks for the alternative.