{"id":18927,"library":"webpack-http-server","title":"webpack-http-server","description":"An on-demand runtime webpack compilation over HTTP, version 0.5.0. It acts as an Express server that accepts compilation requests via HTTP POST or Node.js API, returning a unique preview URL for each compiled module. The server runs on a random port and allows dynamic entrypoints, unlike webpack-dev-server which is scoped to a single compilation. Key differentiators include per-request compilation IDs, preview routes, and a focus on example-driven testing workflows. Released as a lightweight alternative to static compilation setups.","status":"active","version":"0.5.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install webpack-http-server","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-http-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-http-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used to create the HTTP server for compilation and preview routes","package":"express","optional":false},{"reason":"Used as the core compilation engine","package":"webpack","optional":false}],"imports":[{"note":"Named export only; default export not provided","wrong":"const WebpackHttpServer = require('webpack-http-server')","symbol":"WebpackHttpServer","correct":"import { WebpackHttpServer } from 'webpack-http-server'"}],"quickstart":{"code":"import { WebpackHttpServer } from 'webpack-http-server'\n\nconst server = new WebpackHttpServer()\nawait server.listen()\nconsole.log('Server running at:', server.serverUrl)\n\n// Compile a module via Node.js API\nconst result = await server.compile(System.getProperty('user.home') + '/demo/index.js')\nconsole.log('Preview URL:', result.previewUrl)\n\n// Or compile via HTTP\nconst res = await fetch(`${server.serverUrl}/compilation`, {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({ entry: process.cwd() + '/index.js' })\n})\nconst data = await res.json()\nconsole.log('Compilation ID:', data.id)\nconsole.log('Preview URL:', data.previewUrl)","lang":"typescript","description":"Creates a server, listens on a random port, compiles a module via both Node.js API and HTTP POST request, then logs the preview URL."},"warnings":[{"fix":"Use webpack-http-server for runtime compilations only; pre-configure webpacks settings via the environment or webpack.config.js","message":"Node.js API compile() method does not accept webpack configuration options","severity":"gotcha","affected_versions":">=0.1.0 <=0.5.0"},{"fix":"Upgrade to >=0.5.0 which accepts an array of entries","message":"Node.js API compile() method accepts only a single entry path, not an array","severity":"breaking","affected_versions":">=0.1.0 <0.5.0"}],"env_vars":null,"search_vec":"'0.5.0':15 'accept':23 'act':17 'allow':49 'altern':87 'api':31 'compil':11,24,39,63,70,90 'demand':8 'dev':55 'differenti':65 'driven':80 'dynam':50 'entrypoint':51 'exampl':79 'example-driven':78 'express':20 'focus':76 'http':3,13,27 'id':71 'includ':66 'javascript':92 'key':64 'lightweight':86 'modul':40 'node.js':30 'on-demand':6 'per':68 'per-request':67 'port':47 'post':28 'preview':35,72 'random':46 'releas':83 'request':25,69 'return':32 'rout':73 'run':43 'runtim':9 'scope':59 'server':4,21,42,56 'setup':91 'singl':62 'static':89 'test':81 'typescript':93 'uniqu':34 'unlik':52 'url':36 'version':14 'via':26 'webpack':2,10,54 'webpack-dev-serv':53 'webpack-http-serv':1 'workflow':82","created_at":"2026-04-25T07:40:52.329148+00:00","updated_at":"2026-04-25T07:40:52.329148+00:00","problems":[{"fix":"npm install express","cause":"express is a peer dependency that must be installed separately","error":"Cannot find module 'express'"},{"fix":"import { WebpackHttpServer } from 'webpack-http-server'","cause":"Importing default export instead of named export","error":"WebpackHttpServer is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/webpack-http-server","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","http-networking","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}