Skip to content

Consider removing whatwg-url polyfill #400

Open
@Rich-Harris

Description

@Rich-Harris

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    featNew feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions