- 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 and package manager for ES Modules. All modules are transformed to ESM by esbuild from npm.
Import from URL
import React from 'https://esm.sh/react'
Specify version
import React from 'https://esm.sh/react@16.13.1'
Submodule
import { renderToString } from 'https://esm.sh/react-dom/server'
Specify ESM target
import React from 'https://esm.sh/react?target=es2020'
Development mode
import React from 'https://esm.sh/react?dev'
Bundle mode
import React from 'https://esm.sh/[react,react-dom]/react'
import ReactDom from 'https://esm.sh/[react,react-dom]/react-dom'
or your can define bundle list in the import-map.json
(import-maps proposal)
{
"imports": {
"https://esm.sh/": "https://esm.sh/[react,react-dom]/",
...
}
}
import React from 'https://esm.sh/react' // actual from 'https://esm.sh/[react,react-dom]/react'
⚠️ The bundling packages in URL are litmited up to 10, to bundle more packages, please use esm client.
ESM Client in Deno [WIP]
# install esm command
deno install --allow-read --allow-write --allow-net -n esm https://deno.land/x/esm/cli.ts
# add some modules
$ esm add react react-dom
# specify version or tag
$ esm add react@16.13.1
$ esm add react@next
# remove some modules
$ esm remove lodash
# update installed modules to latest version
$ esm update
# help message
$ esm -h
X-Typescript-Types
esm.sh will response a custom HTTP header of X-TypeScript-Types
if the types defined, that is useful for deno types check (link).
Caveat
Different with Skypack and jspm, esm.sh will bundle all dependencies(exclude peerDependencies) for each packages, that means there may be redundant contents transmitted when you are importing multiple packages.
This should be improved when the http/3(quic) is ready. For now the best practice is using the bundle mode.
Self-Hosting
You will need Go 1.14+ to compile the server, and ensure the supervisor installed on your host machine.
The server runtime will check the nodejs installation (12+) exists or install the latest LTS version automatically.
$ git clone https://github.com/postui/esm.sh
$ cd esm.sh
$ sh ./scripts/deploy.sh