Skip to content

bmeck/esm-http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

http-server with esm loader hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published