Skip to content

Commit

Permalink
fix: ensure URL is imported for node.js < v10 (#4)
Browse files Browse the repository at this point in the history
The WHATWG-compatible `URL` class was added in Node.js v6.13.0/v7.0.0,
but was not made a global until v10.0.0. By explicitly importing it from
the `url` module we can support older versions of Node.js.
  • Loading branch information
davecardwell committed Jun 5, 2020
1 parent d62f352 commit 6b990a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
format: "cjs",
sourcemap: true,
},
external: ["events", "inquirer", "puppeteer"],
external: ["events", "inquirer", "puppeteer", "url"],
plugins: [sourcemaps(), babel(), addShebang({ include: outputFile })],
watch: {
clearScreen: false,
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import EventEmitter from "events";
import type TypedEmitter from "typed-emitter";
import inquirer from "inquirer";
import puppeteer, { Browser, Request, Page } from "puppeteer";
import { URL } from "url"; // not added to `global` until Node.js v10

/**
* If we’re being run directly and not imported as a package then call the
Expand Down

0 comments on commit 6b990a6

Please sign in to comment.