Registry / devops / esbuild-plugin-webpack-bridge

esbuild-plugin-webpack-bridge

JSON →
library0.4.0jsnpmunverified

A plugin that enables using webpack loaders within esbuild builds. Current stable version is 0.4.0. Release cadence is irregular; the project is still under development with API subject to change. Key differentiator: bridges the gap between esbuild's speed and webpack's extensive loader ecosystem, allowing reuse of loaders like babel-loader, sass-loader, and postcss-loader without a full webpack setup. Works with ESM and CommonJS esbuild configurations.

npm install esbuild-plugin-webpack-bridge
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-WEB
E
esbuild-plugin-webpack-bridge
devopsjavascriptv0.4.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.

webpackBridge
import webpackBridge from 'esbuild-plugin-webpack-bridge'
const webpackBridge = require('esbuild-plugin-webpack-bridge')
Package does not provide a CommonJS export; use default import.
webpackBridge
import webpackBridge from 'esbuild-plugin-webpack-bridge'
const { webpackBridge } = require('esbuild-plugin-webpack-bridge')
Named import does not exist; use default import.
esbuild
import * as esbuild from 'esbuild'
const esbuild = require('esbuild')
esbuild is ESM-only; use dynamic import or import statement.

Shows how to use esbuild-plugin-webpack-bridge with a Babel loader for JSX/JS files.

import esbuild from 'esbuild'; import webpackBridge from 'esbuild-plugin-webpack-bridge'; await esbuild.build({ entryPoints: ['src/index.jsx'], bundle: true, outfile: 'dist/bundle.js', plugins: [ webpackBridge({ module: { rules: [ { test: /\.jsx?$/, esbuildLoader: 'js', use: [ { loader: 'babel-loader', options: { presets: [['@babel/preset-env', { targets: { ie: 11 } }]], }, }, ], }, ], }, }), ], });
Debug
Known issues
breakingAPI changes in minor versions: the plugin is under development and the configuration format may break without major version bump.
fix
Pin exact version in package.json and monitor releases for breaking changes.
affects: >=0.1.0
gotchaOnly a subset of webpack loader features are supported; for example, pitch loaders and inline matchResource may not work.
fix
Check test/ folder for supported features. Loaders expecting full webpack context may behave unexpectedly.
affects: >=0.0.0
gotchaRequires Node.js >= 12 and esbuild >= 0.8; cannot be used in browsers.
fix
Ensure Node version and esbuild peer dependency are satisfied.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'compilation')
Some webpack loaders expect a full webpack compilation object, which is not provided by this plugin.
fix
Check if the loader relies on webpack internals; consider using a different loader or a workaround.
Error: Could not resolve 'webpack'
The plugin depends on webpack internally but it is not installed.
fix
Install webpack as a dev dependency: npm install --save-dev webpack
Module parse failed: Unexpected token (1:0) - You may need an appropriate loader to handle this file type.
The webpackBridge plugin might not be correctly applied or the rule's test doesn't match the file.
fix
Verify that the esbuildLoader property matches the expected content type (e.g., 'js' for JavaScript, 'css' for stylesheets).
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency required to use the plugin.
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-webpack-bridge — npm install esbuild-plugin-webpack-bridge · libregistry