esm-http-server

2.0.0 • Public • Published

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-server

Usage

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.js

You 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.

Readme

Keywords

Package Sidebar

Install

npm i esm-http-server

Weekly Downloads

0

Version

2.0.0

License

MIT

Last publish

Collaborators

  • bradleymeck