Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider removing whatwg-url polyfill #400

Open
Rich-Harris opened this issue Jun 26, 2019 · 1 comment
Open

Consider removing whatwg-url polyfill #400

Rich-Harris opened this issue Jun 26, 2019 · 1 comment
Labels
feat New feature

Comments

@Rich-Harris
Copy link

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

  • 0.7.3: 28.2kb minified, 8.1kb zipped
  • 0.8.0-beta.0: 377.3kb minified, 95kb zipped

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:

  • Expect developers serving legacy browsers to bring their own polyfill
  • Reimplement the same functionality used by this package in a small utility module

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

@teoxoy
Copy link
Member

teoxoy commented Jun 26, 2019

They mention here why whatwg-url was added

/**
* Browser 'URL' implementations have been found to handle non-standard URL
* schemes poorly, and schemes like
*
* webpack:///src/folder/file.js
*
* are very common in source maps. For the time being we use a JS
* implementation in these contexts instead. See
*
* * https://bugzilla.mozilla.org/show_bug.cgi?id=1374505
* * https://bugs.chromium.org/p/chromium/issues/detail?id=734880
*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature
Projects
None yet
Development

No branches or pull requests

3 participants