Hi, I get the following error:
UnhandledPromiseRejectionWarning: TypeError: puppeteer_extra_plugin_stealth_1.default is not a function
When using the following code to initialize puppeteer-extra:
this.browser = await puppeteer.use(StealthPlugin()).launch(this.settings.puppeteerSettings);
and using these imports:
import puppeteer from 'puppeteer-extra';
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
Does this still happen?
If yes, what version are you using and if bumping the dependencies to their latest version help?
Having a simpler way to reproduce the problem would be nice since i don't know what this.settings.puppeteerSettings holds.
I had the same issue with the latest version. Looks like problem with TypeScript typings definition. My workaround was to change:
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
into
const StealthPlugin = require("puppeteer-extra-plugin-stealth");
This is most likely related to your local tsconfig.json (specifically: allowSyntheticDefaultImports).
See here for more info: https://github.com/berstend/puppeteer-extra/wiki/TypeScript-usage
This is most likely related to your local
tsconfig.json(specifically:allowSyntheticDefaultImports).See here for more info: https://github.com/berstend/puppeteer-extra/wiki/TypeScript-usage
Confirmed, allowSyntheticDefaultImports + esModuleInterop has to be specified and set to true
Most helpful comment
Confirmed,
allowSyntheticDefaultImports+esModuleInterophas to be specified and set to true