Registry / web-framework / browserify-dev-bundler

browserify-dev-bundler

JSON →
library2.0.0jsnpmunverified

On-demand browserify bundler middleware for development with watchify support. Version 2.0.0 is the latest stable release, with low release cadence (last release in 2016). It dynamically bundles CommonJS modules via HTTP requests, caching bundles with watchify for fast responses during development. Unlike manual watchify tasks or file-based bundling, it integrates directly as Express middleware, intercepting *.js requests and bundling on the fly. Not suitable for production—use browserify build process instead. Works with Node.js and Express.

npm install browserify-dev-bundler
INSTALL
IMPORT
SIG · BROWSERIFY-DEV-BUN
B
browserify-dev-bundler
web-frameworkjavascriptv2.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DevBundler
const DevBundler = require('browserify-dev-bundler');
import DevBundler from 'browserify-dev-bundler';
CJS-only package; no ESM exports. Default export is the constructor.
middleware
app.use(bundler.middleware());
app.use(DevBundler.middleware);
middleware() returns a function; must be called on a DevBundler instance.
events
bundler.on('pre-bundle', (bundle, modName, modPath) => {});
bundler.addEventListener('pre-bundle', ...);
Uses Node.js EventEmitter pattern; .on() not addEventListener.

Sets up an Express server with on-demand browserify bundling using the middleware.

const express = require('express'); const DevBundler = require('browserify-dev-bundler'); const path = require('path'); const app = express(); const bundler = DevBundler({ root: path.join(__dirname, 'public', 'js'), watchify: true, debug: true, transforms: [] }); app.use(bundler.middleware()); app.listen(3000, () => console.log('Dev server on 3000')); // Request GET /app.js => bundles public/js/app.js
Debug
Known issues
gotchaMiddleware matches all *.js files by default; may unintentionally bundle non-module JS files or cause conflicts with static file serving.
fix
Use a regex pattern to restrict which URLs are bundled: e.g., bundler.middleware(/^\/js\/(.+)\.js$/).
affects: >=1.0.0
deprecatedwatchify is enabled by default, which may cause high memory usage in large projects or when many files change.
fix
Set watchify: false if you don't need auto-rebundling, or manually manage watchify instances.
affects: >=1.0.0
breakingVersion 2.0.0 changed the default middleware behavior to intercept all *.js; previous versions used a different default pattern.
fix
Update regex patterns if you relied on older defaults; use bundler.middleware(/^\/js\/(.+)\.js$/) to restrict paths.
affects: >=2.0.0
gotchaaddFile option overrides default bundle.add(); using bundle.require() without expose can cause double bundling or missing dependencies.
fix
Ensure addFile function uses bundle.require() with expose option for modules that need to be requireable by other bundles.
affects: >=1.0.0
gotchabundle-error event does not prevent crashes; unhandled errors may crash the server.
fix
Always attach a listener to 'bundle-error' event: bundler.on('bundle-error', err => console.error(err)).
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'browserify'
Missing peer dependency browserify; not automatically installed with npm install.
fix
Run: npm install browserify watchify --save-dev
bundler.middleware is not a function
Forgetting to instantiate DevBundler with new; calling DevBundler() without new returns a constructor, not an instance.
fix
Use: const bundler = new DevBundler(options); or simply DevBundler(options) (works without new due to internal check).
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
browserifyrequiredCore bundler dependency for transforming CommonJS modules into browser-compatible bundles
watchifyrequiredRequired for caching and automatic re-bundling on file changes during development
Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
browserify-dev-bundler — npm install browserify-dev-bundler · libregistry