question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

puppeteer: unable to use default export

See original GitHub issue

The puppeteer type definitions don’t seem to allow me to use the default export:

import puppeteer from "puppeteer";
puppeteer.launch(...);

which is the recommended usage according to the Puppeteer documentation.

Instead, Flow requires

import { launch } from "puppeteer";
launch(...);

because of https://github.com/flow-typed/flow-typed/blob/b426b5f657cc2b688f3aced6eea25fc052f8f797/definitions/npm/puppeteer_v1.12.x/flow_v0.104.x-/puppeteer_v1.12.x.js#L2670 which doesn’t actually work at runtime, because the default export is a class instance and so launch() here is an unbound method.

I’ve detailed the issue here:

https://stackoverflow.com/questions/57705213/flow-type-definitions-for-puppeteer-prevent-using-default-export

Are these type defs actually working for others?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
avalanche1commented, Jun 9, 2020

Yep, same issue in typescript

1reaction
jtbandescommented, Sep 28, 2021

This is the flow-typed repo, which isn’t the right place to discuss TypeScript issues. You should probably file a ticket on DefinitelyTyped.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'"puppeteer"' has no exported member 'puppeteer ... - GitHub
'"puppeteer"' has no exported member 'puppeteer' using Typescript #7028 ... node_modules/puppeteer/lib/types"' has no default export.
Read more >
TypeScript definition does not match default export
I'm trying to use Puppeteer with TypeScript ...
Read more >
puppeteer-extra-plugin-stealth - npm
This plugin uses puppeteer-extra 's dependency system to only require code mods for evasions that have been enabled, to keep things modular and ......
Read more >
How To Scrape a Website Using Node.js and Puppeteer
In this tutorial, you will build a web scraping application using Node.js and Puppeteer. Your app will grow in complexity as you progress....
Read more >
node_modules/puppeteer/lib/types.d.ts - devtools ... - Google Git
By default, Puppeteer tries to approximate this filtering, exposing only ... export declare class Browser extends EventEmitter {. /**. * @internal.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found