{"id":25331,"library":"esbuild-plugin-dev-server","title":"esbuild-plugin-dev-server","description":"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.","status":"active","version":"4.2.10","language":"javascript","source_language":"en","source_url":"https://github.com/kmalakoff/esbuild-plugin-dev-server","tags":["javascript","dev","server","esbuild","plugin","error","overlay","live","reload","typescript"],"install":[{"cmd":"npm install esbuild-plugin-dev-server","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-dev-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-dev-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin integrates with esbuild build process","package":"esbuild","optional":false}],"imports":[{"note":"Package is ESM-first; CommonJS require works but is deprecated. Use import for best compatibility with modern JS/TS.","wrong":"const devServer = require('esbuild-plugin-dev-server');","symbol":"default","correct":"import devServer from 'esbuild-plugin-dev-server';"},{"note":"TypeScript users should import type using `import type` for the options interface; it's not a runtime value.","wrong":"import DevServerOptions from 'esbuild-plugin-dev-server';","symbol":"DevServerOptions","correct":"import type { DevServerOptions } from 'esbuild-plugin-dev-server';"},{"note":"Plugin is a named export for type checking; using require to destructure is incorrect as it's a type export.","wrong":"const { Plugin } = require('esbuild-plugin-dev-server');","symbol":"Plugin","correct":"import devServer, { Plugin } from 'esbuild-plugin-dev-server';"}],"quickstart":{"code":"import esbuild from 'esbuild';\nimport devServer from 'esbuild-plugin-dev-server';\n\nawait esbuild.build({\n  entryPoints: ['./src/index.js'],\n  bundle: true,\n  outfile: './public/bundle.js',\n  plugins: [devServer({ public: './public', port: 3000 })],\n});","lang":"typescript","description":"Sets up a basic esbuild build with the dev server plugin serving static files from './public' on port 3000."},"warnings":[{"fix":"Update plugin usage: `plugins: [devServer(options)]` instead of `plugins: [devServer.plugin(options)]`.","message":"In 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.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade Node to version 18 or later.","message":"Node <18 is no longer supported in v4.0.0+. Older versions may fail with syntax errors.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Add a separate script or use a library like `open` to open the browser after the build is complete.","message":"The dev server does not automatically open a browser. You must configure that yourself if needed.","severity":"gotcha","affected_versions":"*"},{"fix":"Switch to `import devServer from 'esbuild-plugin-dev-server'`.","message":"Using CommonJS `require()` to load the package is deprecated in favor of ESM `import`.","severity":"deprecated","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Update to v4+ and use `devServer(options)` directly in plugins array.","cause":"Using outdated API where devServer returns an object with a `plugin` method.","error":"TypeError: devServer is not a function"},{"fix":"Call devServer with an options object: `devServer({ public: './public' })`.","cause":"Calling devServer() without arguments or with invalid arguments.","error":"Error: The plugin must be called with an options object"},{"fix":"Run `npm install esbuild-plugin-dev-server`.","cause":"Package not installed or not in node_modules.","error":"Module not found: Error: Can't resolve 'esbuild-plugin-dev-server'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}