Loading files
Every file on npm is available at a UNPKG URL. This guide covers the URL pattern, how versions resolve, and how UNPKG picks a file when you don't name one.
The URL pattern
unpkg.com/:package@:version/:file
:package— the package name on npm, including scope (@scope/name).:version— an exact version, a semver range, or a dist-tag. Omit it andlatestis used.:file— the path to a file inside the package. Omit it and UNPKG resolves the package's entry point.
Examples: preact@10.26.4/dist/preact.min.js, react@18.3.1/umd/react.production.min.js, three@0.174.0/build/three.module.min.js.
Versions, ranges, and tags
Ranges and tags (^18, latest) redirect to the exact version they resolve to, so the response you ultimately get is always a permanent URL. For production, pin the full version yourself. See cache performance.
Entry points and exports
With no file path, UNPKG resolves the entry point from package.json: the exports field first (including subpaths and conditions such as ?conditions=react-server), then main. A package can choose its UNPKG default with the unpkg field or the unpkg export condition.
Browsing files
Add a trailing / to browse a directory (unpkg.com/react/), or use the metadata API for the same listing as JSON.