A smaller Universal WHATWG URL, for Browserify/etc.
Last updated 2 years ago by stevenvachon .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install universal-url-lite 
SYNC missed versions from official npm registry.

universal-url-lite NPM Version Build Status Dependency Monitor

A smaller Universal WHATWG URL, for Browserify/etc.

The universal-url package bundles to 392kB (99kB gzipped). This package exists to compile the same to a smaller file size via custom optimizations.

This package is not meant to be required/imported directly. It should be added to your browser build process as an alias.


Node.js >= 6 is required. To install, type this at the command line:

npm install universal-url-lite

Default Shim File Size File Size


"browser": {
  "universal-url": "universal-url-lite"

File size optimizations have been made, particularly the near-complete exclusion of the TR46 implementation. Functionality is essentially the same as the universal-url package, with the exception of IDNA validation and normalization. If a URL contains a hostname with any of the ~4500 Unicode characters requiring a specific casefold, comparison will produce false negatives. Consider this example:

const url1 = 'http://ㅼㅼㅼ/';
const url2 = 'http://ᄯᄯᄯ/';

if (new URL(url1).hostname !== new URL(url2).hostname) {
    // This is wrong

With invalid IDNAs passing through without error, you will instead need to rely on errors produced by XMLHttpRequest/fetch to know that such URLs are unreachable.

Note: You will need to exclude this browser shim from bundle parsing since it has already been compiled. Browserify has the --noparse CLI option and Webpack has the noParse package.json key.

browserify in.js --outfile=out.js --noparse='/project/node_modules/universal-url-lite/lite.js'

"Native" Shim File Size

This actually includes no shim at all for browser builds. Only the latest browsers will be supported.


"browser": {
  "universal-url": "universal-url-lite/native"

Current Tags

  • 2.0.0                                ...           latest (2 years ago)

4 Versions

  • 2.0.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           4 years ago
  • 1.0.0-alpha                                ...           4 years ago
Maintainers (1)
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 5
Dependencies (12)
Dev Dependencies (7)

Copyright 2014 - 2017 © taobao.org |