Hi, let me introduce you to esm.sh, a fast, global content delivery network (CDN) for modern(es2015+) web development that allows you to import es6 modules from a URL:
import React from 'https://esm.sh/react'
Specify version
import React from 'https://esm.sh/react@17.0.1'
Submodule
import { renderToString } from 'https://esm.sh/react-dom/server'
Deno compatibility
esm.sh will polyfill the node internal modules(fs, os, etc..) with https://deno.land/std/node
to support some modules to work 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()).content
X-Typescript-Types
By default, esm.sh will response a custom HTTP header of X-TypeScript-Types
when the types(dts) defined, that is useful for Deno types check (link).
More usages
Please check https://esm.sh
Open source
esm.sh is licensed under the MIT License.
Top comments (0)