npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

resolve-url-modern

v0.3.0

Published

A maintained, browser-compatible continuation of resolve-url.

Readme

resolve-url-modern

A maintained, compatibility-first continuation of the deprecated resolve-url browser library.

The public API remains one function, resolveUrl(...urls). It resolves every argument from left to right using the browser's URL behavior. This is not a general-purpose Node.js URL resolver.

Compatibility policy

Existing behavior wins over internal novelty. Changes are checked in real Chromium, Firefox, and WebKit against a licensed copy of the 0.2.1 implementation. See COMPATIBILITY.md for details.

Install

npm install resolve-url-modern

The package has no runtime dependencies and no build step.

CommonJS

Use the CommonJS export in browser-targeted code or a browser bundle:

var resolveUrl = require("resolve-url-modern")

resolveUrl("/static/scripts/app.js", "../source-maps/app.js.map")
// https://example.com/static/source-maps/app.js.map

Requiring the module in Node.js returns the function, but calling it needs a browser document. Node.js-only execution is not a supported runtime API.

Browser global and AMD

The distributed file can be loaded directly as a classic script:

<script src="resolve-url.js"></script>
<script>
  resolveUrl("remove")
</script>

The global name is resolveUrl. The same file retains its original AMD define(factory) branch.

API: resolveUrl(...urls)

Pass one or more URL values. The first value is resolved against the document's used base URL. Each later value is resolved against the previous result. The final string is returned.

resolveUrl(
  "/static/scripts/app.js",
  "../source-maps/app.js.map",
  "../coffee/app.coffee"
)
// https://example.com/static/coffee/app.coffee

Calling resolveUrl() with no arguments throws:

Error: resolveUrl requires at least one argument; got none.

Values are converted to strings by browser DOM URL properties, as in the original package.

Browser support

Compatibility is tested with the Chromium, Firefox, and WebKit versions bundled by the locked Playwright release. The package no longer claims the original IE 8, Opera 12, or Safari 5 matrix.

Migration from resolve-url

Usually only the dependency and import name change:

-var resolveUrl = require("resolve-url")
+var resolveUrl = require("resolve-url-modern")

After publication and registry verification, an npm alias can keep source imports unchanged:

{
  "dependencies": {
    "resolve-url": "npm:resolve-url-modern@^0.3.0"
  }
}

ESM

There is no separate ESM entry point. Keeping CommonJS, AMD, and browser-global interfaces avoids a build pipeline. ESM consumers should use their runtime or bundler's CommonJS interop.

Known differences

Version 0.3.0 keeps the original resolver implementation, so no result differences are accepted. Package metadata, development tooling, browser coverage, and documentation changed. MODERNIZATION.md explains why the first WHATWG URL candidate was not shipped.

Development

npm install
npx playwright install chromium firefox webkit
npm test

The suite runs Golden Master and differential checks in all three engines.

License

MIT. Simon Lydell's original copyright notice is retained in LICENSE and the copied fixture.