Registry / devops / esbuild-webpack-plugin

esbuild-webpack-plugin

JSON →
library1.1.0jsnpmunverified

A webpack plugin that uses esbuild as a JavaScript minifier. Version 1.1.0 requires webpack 4+ and ships TypeScript type definitions. It provides a faster alternative to TerserPlugin by leveraging esbuild's built-in minification, which can significantly reduce build times especially for large projects. The plugin supports custom esbuild options such as target and minify settings. No other minifier plugin is needed; it replaces TerserPlugin in the webpack minimizer configuration. Development appears active but no recent commits (last commit in 2020).

npm install esbuild-webpack-plugin
INSTALL
IMPORT
SIG · ESBUILD-WEBPACK-PL
E
esbuild-webpack-plugin
devopsjavascriptv1.1.0
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.

ESBuildPlugin
import ESBuildPlugin from 'esbuild-webpack-plugin'
const ESBuildPlugin = require('esbuild-webpack-plugin').default
Default export is the plugin class. In CommonJS, require().default is needed because of ESM interop.
ESBuildPlugin
const { default: ESBuildPlugin } = require('esbuild-webpack-plugin')
const ESBuildPlugin = require('esbuild-webpack-plugin')
Direct require gives an object with default property. Wrong: using esbuild-webpack-plugin as constructor without .default will throw TypeError.
ESBuildPlugin
const ESBuildPlugin = require('esbuild-webpack-plugin').default
CommonJS pattern. Works with webpack config files using module.exports.

Replaces TerserPlugin with esbuild for minification in webpack 4+.

// webpack.config.js const ESBuildPlugin = require('esbuild-webpack-plugin').default; module.exports = { optimization: { minimizer: [ new ESBuildPlugin(), ], }, };
Debug
Known issues
breakingPlugin requires webpack 4+. Does not work with webpack 5.
fix
Use an alternative like esbuild-loader or upgrade to a webpack 5 compatible plugin.
affects: >=1.0.0
gotchaCommonJS require does not return the constructor directly; must use .default
fix
Use require('esbuild-webpack-plugin').default or switch to ES import syntax.
affects: >=1.0.0
deprecatedPackage has not been updated since 2020. May not work with newer esbuild versions.
fix
Consider using esbuild-loader for active maintenance.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: ESBuildPlugin is not a constructor
CommonJS require returns an object with default property, not the class directly.
fix
Use require('esbuild-webpack-plugin').default or import syntax.
Error: webpack.optimize.minimizer[0] is not a plugin
Minimizer expects a plugin instance, but ESBuildPlugin is used incorrectly.
fix
Ensure you instantiate the plugin: new ESBuildPlugin(). Not a reference to the class.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
webpackrequiredpeer dependency: plugin interfaces with webpack's optimization stage
esbuildoptionalcore minification engine (not a direct dependency but must be installed)
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-webpack-plugin — npm install esbuild-webpack-plugin · libregistry