Sequential URL resolution for JavaScript and TypeScript.
resolve-url is deprecated and used browser anchor elements to resolve URLs. This package keeps the same left-to-right resolution model, uses the standard URL API, and adds an explicit Node-friendly base helper.
npm install url-resolve-modernimport { resolveUrl, resolveUrlFrom } from "url-resolve-modern";
resolveUrl("https://example.com/articles/resolving-urls/edit", "remove");
// "https://example.com/articles/resolving-urls/remove"
resolveUrlFrom(
"https://example.com/static/scripts/app.js",
"../source-maps/app.js.map",
"../coffee/app.coffee"
);
// "https://example.com/static/coffee/app.coffee"In browsers, resolveUrl("relative/path") uses window.location.href as the starting base. In Node, provide an absolute first URL or use resolveUrlFrom(base, ...urls).
Resolves URLs left to right. The first URL must be absolute unless a browser window.location base exists.
Resolves URLs left to right from an explicit base.
Returns whether a value can be parsed as an absolute URL.
Thrown when resolution needs a base but none is available.
url-resolve-modern is an independent alternative or migration helper for projects moving away from resolve-url. It is not affiliated with the original package maintainers or project.
For release context, see the local migration guide, examples, compatibility notes, source metadata, and adoption plan.