Max van der Velde
Max van der Velde
DDeno
Created by Max van der Velde on 8/3/2023 in #help
Importing `puppeteer-cluster` from esm.sh causes `does not provide an export named 'default'` error
When importing https://esm.sh/puppeteer-cluster@0.23.0 I get the following error:
error: Uncaught SyntaxError: The requested module '/v130/y18n@5.0.8/denonext/y18n.mjs' does not provide an export named 'default'
at <anonymous> (https://esm.sh/v130/yargs@17.7.1/denonext/helpers.js:4:1997)
error: Uncaught SyntaxError: The requested module '/v130/y18n@5.0.8/denonext/y18n.mjs' does not provide an export named 'default'
at <anonymous> (https://esm.sh/v130/yargs@17.7.1/denonext/helpers.js:4:1997)
I'm not sure how to reslove this, anyone have an idea? My code looks something like this:
import { Cluster } from "https://esm.sh/puppeteer-cluster@0.23.0";

const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_PAGE,
maxConcurrency: 10,
});

// etc...
import { Cluster } from "https://esm.sh/puppeteer-cluster@0.23.0";

const cluster = await Cluster.launch({
concurrency: Cluster.CONCURRENCY_PAGE,
maxConcurrency: 10,
});

// etc...
1 replies
DDeno
Created by Max van der Velde on 7/11/2023 in #help
Deno seems to assume wrong return type (Puppeteer)
With the following code, I get an type error which I do not expect:
const element: ElementHandle | null = await page.$('span.label-status');
const shouldBeString: string = await element?.$eval('a', (el): string => el.innerText);
const element: ElementHandle | null = await page.$('span.label-status');
const shouldBeString: string = await element?.$eval('a', (el): string => el.innerText);
On the shouldBeString I receive the following type error:
Type 'ElementHandle<any> | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
Type 'ElementHandle<any> | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
Even though $eval() returns any type: https://pptr.dev/api/puppeteer.page._eval Anyone have an idea how to fix this?
14 replies