use global URL instead of node url module #325
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Node 10 added a global
URL
. The alias underrequire('url').URL
is completely equivalent, except for some reason all the Node URL polyfills don't seem to bother to addURL
to the 'url'
module and so it doesn't work automatically when bundled (using the default browserify and rollup polyfills, at least).This has always worked anyways in Lighthouse because the library
robots-parser
getsURL
the same way and so it's had to be manually patched, but the way we did it was kind of a hack. We have to change how we patch it in Lighthouse so I was trying to remember why we did it this hacky way (goes back to GoogleChrome/lighthouse#5293) and realized pubads also needed it.This PR isn't pressing because we still need to get it changed in
robots-parser
and it's still a pretty trivial workaround in the meantime, but since URL has been a global for so long, it seems as good a time as any to start backing out the need for a polyfill or patch.