2.0.0 • Published 8 years ago
esm-http-server v2.0.0
ESM HTTP Server
A server that can intelligently handle ESM specifiers.
CLI
# serve from fs
PORT=8080 esm-http-server
# serve as proxy
PORT=8081 HTTP_PROXY=http://localhost:8080/serve/ esm-http-serverUsage
All files will be served under the /serve/ prefix, so a index.html file at the root of the location providing content would be available at /serve/index.html.
Using a loader
By default specifiers follow the WHATWG module resolution algorithm.
PORT=8080 esm-http-server --loader loader.jsYou can inspect the shape of the default loader to see what a custom one needs to provide. These loaders are designed to be composable and multiple --loader flags are allowed and are constructed from left to right with the left as the final loader and the right as the first loader that intercepts requests.
Limitations
Since the server only intercepts JS MIME types, if you serve non-module JS under a different MIME it will not be intercepted.