esbuild-plugin-browserify-adapter
raw JSON → 0.1.5 verified Fri May 01 auth: no javascript
Adapter (v0.1.5, low activity) that lets you use Browserify transforms as esbuild plugins. Designed for gradual migration from Browserify to esbuild, it passes transforms in order and supports options via array wrapping. Does not support Browserify plugins. Not intended as permanent solution for heavy transform usage.
Common errors
error Error: Cannot find module 'esbuild-plugin-browserify-adapter' ↓
cause Package not installed or missing from node_modules.
fix
Run 'npm install esbuild-plugin-browserify-adapter -D'
error TypeError: browserifyAdapter is not a function ↓
cause Named import used instead of default import.
fix
Use 'const browserifyAdapter = require('esbuild-plugin-browserify-adapter')'
error Error: [plugin browserify-adapter] Transform returned invalid result ↓
cause Browserify transform produces output incompatible with esbuild expectations.
fix
Check transform compatibility; consult transform docs for esbuild usage.
Warnings
breaking Does not work with Browserify plugins (only transforms). ↓
fix Use only Browserify transforms, not plugins like browserify-css.
gotcha Options must be passed as an array [transform, options] – not as separate arguments. ↓
fix Wrap transform and options in an array: browserifyAdapter([transform, opts])
gotcha The adapter is intended for migration, not permanent use with heavy transform usage (may cause performance issues or incompatibilities). ↓
fix Consider native esbuild plugins for long-term solutions.
Install
npm install esbuild-plugin-browserify-adapter yarn add esbuild-plugin-browserify-adapter pnpm add esbuild-plugin-browserify-adapter Imports
- default wrong
import browserifyAdapter from 'esbuild-plugin-browserify-adapter'correctconst browserifyAdapter = require('esbuild-plugin-browserify-adapter') - browserifyAdapter wrong
const { browserifyAdapter } = require('esbuild-plugin-browserify-adapter')correctconst browserifyAdapter = require('esbuild-plugin-browserify-adapter') - plugin usage wrong
browserifyAdapter(coffeeify, envify, opts)correctbrowserifyAdapter(coffeeify, [envify, opts])
Quickstart
const esbuild = require('esbuild');
const coffeeify = require('coffeeify');
const envify = require('envify');
const browserifyAdapter = require('esbuild-plugin-browserify-adapter');
esbuild.build({
entryPoints: ['./app.coffee'],
bundle: true,
plugins: [browserifyAdapter(coffeeify, [envify, { BUNDLE_TIME: new Date().toJSON() }])],
outdir: './public'
}).catch(() => process.exit(1));