mozilla / source-map

Consume and generate source maps.
Other
3.56k stars 359 forks source link

Consider removing whatwg-url polyfill #400

Open Rich-Harris opened 5 years ago

Rich-Harris commented 5 years ago

Hi all. We're considering adopting source-map in a project that will be used in browsers, and this chart is giving us pause:

Screen Shot 2019-06-26 at 10 40 52

This stark difference is entirely accounted for by the addition of whatwg-url as a dependency. It doesn't affect Node at all (which either uses the built in URL object or require("url").URL as appropriate), so this polyfill is for the benefit of browsers that don't support URL, which is basically just IE and Opera Mini.

If this package is intended to be used in browsers, I'd argue that keeping the bundle size small is a worthwhile goal. I see a couple of options:

I'd be happy to work on a pull request if you could give me some guidance. Thank you!

teoxoy commented 5 years ago

They mention here why whatwg-url was added

https://github.com/mozilla/source-map/blob/02f3d6bbcd4cb2c15dc7083d9afb561879ad2b25/lib/url-browser.js#L9-L20