- v135_7Latest
- v135_6
- v136_6
- v135_5
- v135_4
- v135_3
- v135_2
- v135_1
- v135
- v134
- v133
- v132
- v131
- v130
- v129
- v128
- v127
- v126
- v125
- v124
- v123
- v122
- v121
- v120
- v119
- v118
- v117
- v116
- v115
- v114
- v113
- v112
- v111
- v110
- v109
- v108
- v107
- v106
- v105
- v104
- v103
- v102
- v101
- v100
- v99
- v98
- v97
- v96
- v95
- v94
- v93
- v92
- v91
- v90
- v89
- v88
- v87
- v86
- v85
- v84
- v83
- v82
- v81
- v80
- v79
- v78
- v77
- v76
- v75
- v74
- v73
- v72
- v71
- v70
- v69
- v68
- v67
- v66
- v65
- v64
- v63
- v62
- v61
- v60
- v59
- v56
- v57
- v55
- v53
- v52
- v51
- v50
- v49
- v48
- v47
- v46
- v45
- v44
- v43
- v41
- v40
- v39
- v38
- v37
- v35
- v34
- v0.1.0
- v0.0.1
ESM
A fast, global content delivery network for ES Modules. All modules in NPM are transformed to ESM by esbuild.
Import from URL
import React from 'https://esm.sh/react'
Specify version
import React from 'https://esm.sh/react@17.0.2'
Submodule
import { renderToString } from 'https://esm.sh/react-dom/server'
or import non-module(js) files:
import 'https://esm.sh/tailwindcss/dist/tailwind.min.css'
Bundle mode
import React from 'https://esm.sh/antd?bundle'
In bundle mode, all dependencies will be bundled into one JS file.
Development mode
import React from 'https://esm.sh/react?dev'
Specify external deps
import React from 'https://esm.sh/react@16.14.0'
import useSWR from 'https://esm.sh/swr?deps=react@16.14.0'
Package CSS
import Daygrid from 'https://esm.sh/@fullcalendar/daygrid'
<link rel="styelsheet" href="https://esm.sh/@fullcalendar/daygrid?css">
Specify ESM target
import React from 'https://esm.sh/react?target=es2020'
By default, esm.sh will check the User Agent
of browser to get the build target, or set it by the target
query. Avaiable target
: es2015 - es2020, esnext, and deno.
Deno compatibility
esm.sh will resolve the node internal modules (fs, os, etc) with deno.land/std/node
to support some packages working in Deno, like postcss
:
import postcss from 'https://esm.sh/postcss'
import autoprefixer from 'https://esm.sh/autoprefixer'
const { css } = await postcss([ autoprefixer ]).process(`
backdrop-filter: blur(5px);
user-select: none;
`).async()
console.log(css)
X-Typescript-Types
By default, esm.sh will response a custom HTTP header that is X-TypeScript-Types
when the types(dts) is defined, this is useful for deno types check (link).
You can pass the no-check
query to disable the X-TypeScript-Types
header if some types are incorrect:
import unescape from 'https://esm.sh/lodash/unescape?no-check'
Network of esm.sh
- Main server in HK
- Global CDN by Cloudflare
- China CDN by Aliyun (use mmdb_china_ip_list to split traffic)
Self-Hosting
You will need Go 1.16+ to compile the server, and ensure supervisor installed on your host machine.
The server runtime will install the nodejs (14 LTS) automatically.
$ git clone https://github.com/postui/esm.sh
$ cd esm.sh
$ sh ./scripts/deploy.sh