Registry / web-framework / esbuild-dev-router

esbuild-dev-router

JSON →
library0.8.0jsnpmunverified

Express middleware for development with esbuild. Bundles TypeScript/JavaScript source files in memory, serves them directly, and automatically reloads the browser on file changes via Server-Sent Events. Current stable version is 0.8.0. Peer dependency on esbuild >0.17. Key differentiators: zero-config live reload injection, no disk writes, mounts as Express Router, merges loader and plugin configs so you can extend defaults. Best for teams that already use Express and esbuild and want a lightweight dev server without Webpack or Vite.

web-frameworkdevopshttp-networking
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESM-only; in TypeScript, you can also use the named export 'devRouter'

import devRouter from 'esbuild-dev-router'

Both default and named exports point to the same function. The named export may be easier in some bundler setups.

import { devRouter } from 'esbuild-dev-router'

Re-exports esbuild's BuildOptions type for convenience. Use it to type your config object.

import { BuildOptions } from 'esbuild-dev-router'

Sets up a basic Express dev server with esbuild-dev-router, bundling src/index.ts into memory and serving static files from public/.

import express from 'express'; import devRouter from 'esbuild-dev-router'; import { resolve } from 'path'; const app = express(); const port = process.env.PORT ?? 5000; app.use(devRouter({ entryPoints: [resolve(process.cwd(), 'src/index.ts')], outdir: resolve(process.cwd(), 'dist'), // used for path resolution only })); app.use(express.static(resolve(process.cwd(), 'public'))); app.listen(port, () => { console.log(`Dev server running on http://localhost:${port}`); });
Debug
Known footguns
breakingMust be mounted at root path — the SSE reloader endpoint is hardcoded to '/reloader'.
deprecatedThe 'write' option is always forced to false and cannot be overridden.
gotchaDefaults merge for 'loader', 'plugins', and 'inject' but other options replace defaults.
gotchaNode.js 18+ required. Older Node versions may fail due to modern APIs used internally.
gotchaEntry point output filename determines the URL path. E.g., 'src/index.ts' produces '/index.js' and '/index.css'.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
3
ahrefsbot
3
claudebot
3
Resources