You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

multi-user-dev-server

Package Overview
Dependencies
Maintainers
13
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multi-user-dev-server

Create a webpack dev server that supports multiple users (or configs) on one port.

1.7.1
latest
Source
npm
Version published
Weekly downloads
4
100%
Maintainers
13
Weekly downloads
 
Created
Source

multi-user-dev-server

This creates a web service that runs webpack --watch for multiple users/configs. It can be controlled by a simple web API.

Example

Try example/app.js with

npm install
npm start

curl --data '' http://localhost:8080/bundle/user1
curl --data '' http://localhost:8080/bundle/user2

curl --data '' http://localhost:8080/reload/user1
curl --data '' http://localhost:8080/reload/user2

Usage

const multiUserDevServer = require('multi-user-dev-server');

const app = multiUserDevServer(username => {
  return {
    // The path to this user's webpack config
    configPath: `${__dirname}/${username}/webpack.config.js`,
    // The `env` to pass into the webpack config
    webpackEnv: {},
    // What to respond with for `GET /:username` (optional)
    successResponse: `Bundle completed in ${__dirname}/${username}`,
  };
}, 3600 /* seconds after which unaccessed webpack instances will be stopped */);

app.listen(8080);

Server API

Start building username's webpack bundle and wait until it completes. If it's already building, this will wait to respond until building is complete.

POST /bundle/:username

Reload username's webpack config.

POST /reload/:username

FAQs

Package last updated on 19 Jan 2022

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