Registry / web-framework / browserify-dev-middleware

browserify-dev-middleware

JSON →
library1.5.0jsnpmunverified

Browserify Dev Middleware provides an Express/Connect-compatible middleware for Node.js environments, designed to compile Browserify files on request specifically for development purposes. It enables dynamic bundling of client-side JavaScript, supporting features like specifying a source directory for assets, applying Browserify transforms (e.g., `jadeify`), global transforms (e.g., `deamdify`), and passing arbitrary Browserify options directly. This approach allows developers to avoid pre-compilation steps during local development, serving fresh bundles dynamically. The package is currently at version 1.5.0. However, its GitHub repository was archived in October 2021, indicating it is no longer actively maintained, making its release cadence effectively ceased. Its key differentiator was its simplicity in integrating on-demand Browserify compilation into existing Node.js servers, contrasting with more complex static asset pipelines.

npm install browserify-dev-middleware
INSTALL
IMPORT
SIG · BROWSERIFY-DEV-MID
B
browserify-dev-middleware
web-frameworkjavascriptv1.5.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.

browserifyDevMiddleware
const browserifyDevMiddleware = require('browserify-dev-middleware');
import browserifyDevMiddleware from 'browserify-dev-middleware';
This package is CommonJS-only and does not support ES module `import` syntax.

This quickstart demonstrates how to integrate `browserify-dev-middleware` with an Express application to serve a Browserify-bundled file on demand. It configures the middleware to watch a specified `assets` directory and serves `commit.js` dynamically, which can then be included in an HTML page.

const express = require('express'); const browserifyDevMiddleware = require('browserify-dev-middleware'); const path = require('path'); const app = express(); const assetsPath = path.join(__dirname, 'assets'); // Create a dummy asset file for demonstration const fs = require('fs'); if (!fs.existsSync(assetsPath)) { fs.mkdirSync(assetsPath); } fs.writeFileSync(path.join(assetsPath, 'commit.js'), 'module.exports = { message: "Hello from browserify!" };'); app.use(browserifyDevMiddleware({ src: assetsPath, // Example of adding a transform, typically 'jadeify' or similar // For this quickstart, we'll just demonstrate general options. // transforms: [require('some-browserify-transform')] noParse: [], insertGlobals: true })); app.get('/', (req, res) => { res.send(` <!DOCTYPE html> <html> <head> <title>Browserify Dev Middleware Example</title> </head> <body> <h1>Check console for bundled output</h1> <script src="/commit.js"></script> <script> // commit.js will be served at /commit.js thanks to the middleware fetch('/commit.js') .then(response => response.text()) .then(text => console.log('Bundle content:', text)) .catch(error => console.error('Error fetching bundle:', error)); // You can also try to access window.module.exports directly if the bundle exposes it. // This depends on browserify's output format. </script> </body> </html> `); }); const PORT = process.env.PORT || 3000; app.listen(PORT, () => { console.log(`Server listening on http://localhost:${PORT}`); console.log(`Access /commit.js in your browser to see the bundled file.`); });
Debug
Known issues
breakingThe `browserify-dev-middleware` GitHub repository was archived in October 2021. This package is no longer actively maintained, meaning there will be no further bug fixes, security patches, or feature updates. Users should consider migrating to alternative solutions for long-term projects.
fix
Evaluate modern asset bundling solutions like Webpack, Rollup, Vite, or a more actively maintained Browserify middleware (e.g., `browserify-middleware` by ForbesLindesay) for development environments.
affects: >=1.5.0
gotchaThis package is built for CommonJS (CJS) environments and uses `require()` for module loading. It does not natively support ES Modules (`import`/`export`) syntax.
fix
Ensure your Node.js project uses CommonJS modules (`.js` files with `require`/`module.exports`, or `type: "commonjs"` in `package.json`). If integrating with an ES Module project, a CJS wrapper or dynamic `import()` might be required, but it's generally advised to use an ESM-compatible bundler.
affects: >=1.0.0
gotchaThe package's Node.js engine requirement is `>= 4.0`. While it might function on newer Node.js versions, it has not been tested or updated for compatibility with recent Node.js releases, potentially leading to unforeseen issues, especially with breaking changes in Node.js APIs or internal modules.
fix
Test thoroughly on your target Node.js version. For production or new projects, consider modern alternatives that are actively maintained and support current Node.js LTS releases.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: app.use is not a function
The `browserify-dev-middleware` package returns a middleware function. This error typically occurs when attempting to use it with a framework that doesn't provide an `app.use` method, or if `app` is not correctly initialized as an Express/Connect application.
fix
Ensure you have an Express or Connect app instance (`const app = express();` or `const app = connect();`) and that `app.use` is called on that instance.
SyntaxError: Cannot use import statement outside a module
This error arises when trying to use ES module `import` syntax (`import browserifyDevMiddleware from 'browserify-dev-middleware';`) in a Node.js project configured for CommonJS, or in a script where `browserify-dev-middleware` expects CommonJS `require()`.
fix
Change your import statement to use CommonJS `require()`: `const browserifyDevMiddleware = require('browserify-dev-middleware');`.
Upgrade
Version history
1.5.0latest on npm
Audit
Dependencies
browserifyrequiredCore bundler dependency for compilation functionality.
Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
browserify-dev-middleware — npm install browserify-dev-middleware · libregistry