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

why not simply use URL? #117

Closed
jimmywarting opened this issue Apr 5, 2023 · 1 comment
Closed

why not simply use URL? #117

jimmywarting opened this issue Apr 5, 2023 · 1 comment

Comments

@jimmywarting
Copy link

what is the point of this lib when someone can just simply do:

const x = new URL(path, base).toString()
@jridgewell
Copy link
Owner

jridgewell commented Apr 5, 2023

  1. Webpack's sourcemap URLs aren't compliant URLs, see Unable to run extract-i18n command due to sourcemapping error angular/angular-cli#22526 and https://github.com/mattlewis92/source-map-bug
  2. URL can't handle file paths, only absolute URLs, so new URL('path/to/file.js', 'output/path') in a local build's sourcemaps would error
  3. It's much faster to use a Regex

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

No branches or pull requests

2 participants