Registry / web-framework / esbuild-plugin-dev-server

esbuild-plugin-dev-server

JSON →
library4.2.10jsnpmunverified

Dev server plugin for esbuild that provides live reload and error overlay. Current stable version is 4.2.10, released on npm with frequent updates. Key differentiators: integrates directly with esbuild's build process, supports Express and Electron examples, provides built-in error overlay for development. Requires Node >=18. Ships TypeScript types.

npm install esbuild-plugin-dev-server
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-DEV
E
esbuild-plugin-dev-server
web-frameworkjavascriptv4.2.10
harness data pending
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.

default
import devServer from 'esbuild-plugin-dev-server';
const devServer = require('esbuild-plugin-dev-server');
Package is ESM-first; CommonJS require works but is deprecated. Use import for best compatibility with modern JS/TS.
DevServerOptions
import type { DevServerOptions } from 'esbuild-plugin-dev-server';
import DevServerOptions from 'esbuild-plugin-dev-server';
TypeScript users should import type using `import type` for the options interface; it's not a runtime value.
Plugin
import devServer, { Plugin } from 'esbuild-plugin-dev-server';
const { Plugin } = require('esbuild-plugin-dev-server');
Plugin is a named export for type checking; using require to destructure is incorrect as it's a type export.

Sets up a basic esbuild build with the dev server plugin serving static files from './public' on port 3000.

import esbuild from 'esbuild'; import devServer from 'esbuild-plugin-dev-server'; await esbuild.build({ entryPoints: ['./src/index.js'], bundle: true, outfile: './public/bundle.js', plugins: [devServer({ public: './public', port: 3000 })], });
Debug
Known issues
breakingIn v4.0.0, the plugin signature changed from `devServer()` returning an esbuild plugin object to `devServer(options)` that must be called directly in the plugins array.
fix
Update plugin usage: `plugins: [devServer(options)]` instead of `plugins: [devServer.plugin(options)]`.
affects: >=4.0.0
breakingNode <18 is no longer supported in v4.0.0+. Older versions may fail with syntax errors.
fix
Upgrade Node to version 18 or later.
affects: >=4.0.0
gotchaThe dev server does not automatically open a browser. You must configure that yourself if needed.
fix
Add a separate script or use a library like `open` to open the browser after the build is complete.
affects: *
deprecatedUsing CommonJS `require()` to load the package is deprecated in favor of ESM `import`.
fix
Switch to `import devServer from 'esbuild-plugin-dev-server'`.
affects: >=4.0.0
Errors
Common errors & fixes
TypeError: devServer is not a function
Using outdated API where devServer returns an object with a `plugin` method.
fix
Update to v4+ and use `devServer(options)` directly in plugins array.
Error: The plugin must be called with an options object
Calling devServer() without arguments or with invalid arguments.
fix
Call devServer with an options object: `devServer({ public: './public' })`.
Module not found: Error: Can't resolve 'esbuild-plugin-dev-server'
Package not installed or not in node_modules.
fix
Run `npm install esbuild-plugin-dev-server`.
Upgrade
Version history
4.2.10latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency; plugin integrates with esbuild build process
Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-plugin-dev-server — npm install esbuild-plugin-dev-server · libregistry