esm.unpkg.com is currently in beta. It serves browser-ready ES modules from npm packages using UNPKG infrastructure. Use it when a package is not already published as browser-ready ESM and you want to load it directly in modern browsers without a build step.
https://esm.unpkg.com/:package@:version/:subpath
Example
Import packages from esm.unpkg.com in a module script:
<script type="module">
import React from "https://esm.unpkg.com/react@18.3.1";
import { createRoot } from "https://esm.unpkg.com/react-dom@18.3.1/client";
createRoot(document.getElementById("root")).render(
React.createElement("h1", null, "Hello from esm.unpkg.com")
);
</script>Usage
- Omit the version to use the package's
latestnpm tag. - Use npm dist-tags, semver ranges, or exact versions in the URL.
- Add
?target=es2022to choose an output target. - Add
?devfor development builds. - Add
?metato inspect resolved module metadata.
Documentation
The full reference — every parameter, stylesheet handling, and error format — lives in the browser modules guide on the main UNPKG site. This page is only a pointer; the guide is the canonical documentation.