Socket
Book a DemoInstallSign in
Socket

esm-http-server

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esm-http-server

http server with esm loader hooks

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

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.

Keywords

esm

FAQs

Package last updated on 04 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts