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
?bundle,?standalone, or?no-bundleto control bundling. - Add
?metato inspect resolved module metadata.
Documentation
For official UNPKG documentation, including package URLs, exports, metadata, import maps, and browser module options, visit the main UNPKG home page. The browser modules section is available at https://unpkg.com/#browser-modules.