Registry / web-framework / browserify-server

browserify-server

JSON →
library2.1.18jsnpmunverified

browserify-server is a utility package that integrates Browserify bundling with a simple static file server. It aims to streamline local development by automatically bundling JavaScript files and serving them alongside other static assets, such as HTML and CSS, from a specified directory. The package's primary function is to eliminate boilerplate code typically required to set up a development server with Browserify. Currently at version 2.1.18, its release cadence is effectively inactive, reflecting the broader industry shift away from Browserify as a primary module bundler for new projects. Its key differentiator was its simplicity for Browserify-based workflows, providing a 'zero-config' approach to serving bundles, which has largely been superseded by integrated development servers in modern bundlers like Webpack, Rollup, and Vite.

npm install browserify-server
INSTALL
IMPORT
SIG · BROWSERIFY-SERVER
B
browserify-server
web-frameworkjavascriptv2.1.18
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.

handler
const handler = require('browserify-server')
import handler from 'browserify-server'
The package's main export is a function that acts as an HTTP request handler. It is exclusively a CommonJS module and does not support ESM imports directly.
BrowserifyServerHandler
/** @typedef {function} BrowserifyServerHandler */ const handler = require('browserify-server')
import { BrowserifyServerHandler } from 'browserify-server'
This package does not ship TypeScript types, nor does it have named exports. For type hinting in JSDoc, you might define a simple typedef. Attempting named ESM imports will fail.
createServer
const http = require('http'); const handler = require('browserify-server'); const server = http.createServer(handler);
import { createServer } from 'browserify-server/http'; // Or similar attempt to import internal Node modules via package
browserify-server exports only the handler function. The `http` module is a Node.js built-in that must be imported separately to create the server instance.

This quickstart demonstrates how to create a basic HTTP server using `browserify-server`. It sets up a handler to serve static files from a './static' directory and automatically bundles and serves 'index.js' as '/bundle.js'.

const handler = require("browserify-server")("./static"); const http = require("http"); const path = require('path'); const fs = require('fs'); // Create a dummy static directory and an index.html for the example const staticPath = path.join(__dirname, 'static'); if (!fs.existsSync(staticPath)) { fs.mkdirSync(staticPath); } fs.writeFileSync(path.join(staticPath, 'index.html'), '<html><body><h1>Hello from browserify-server!</h1><script src="/bundle.js"></script></body></html>'); fs.writeFileSync(path.join(staticPath, 'index.js'), 'document.addEventListener(\'DOMContentLoaded\', () => console.log(\'Bundle loaded!\'));'); const server = http.createServer(handler); const port = process.env.PORT ?? 8080; server.listen(port, () => { console.log(`HTTP server listening on port ${port}`); console.log(`Open http://localhost:${port} in your browser.`); console.log(`Access bundled JS at http://localhost:${port}/bundle.js`); }); // Clean up static files after server closes (optional for quickstart) process.on('SIGINT', () => { server.close(() => { console.log('Server stopped. Cleaning up static files...'); fs.unlinkSync(path.join(staticPath, 'index.html')); fs.unlinkSync(path.join(staticPath, 'index.js')); fs.rmdirSync(staticPath); process.exit(0); }); });
browserify-server --version
Debug
Known issues
deprecatedThe underlying Browserify technology, while functional, is largely superseded by modern bundlers like Webpack, Rollup, and Vite. New projects are unlikely to choose Browserify-server.
fix
Consider migrating to a project using Webpack Dev Server, Vite, or Parcel for a more modern and feature-rich development experience.
affects: >=1.0.0
gotchaThis package is a CommonJS module and does not support ES Modules (ESM) import syntax. Attempting to use `import` statements will result in runtime errors.
fix
Ensure your project is configured for CommonJS, or use `require()` syntax. If working in an ESM-first environment, consider a different bundler/server combination.
affects: >=1.0.0
gotchaThe package appears to be largely unmaintained, with its last significant updates occurring several years ago. This may lead to compatibility issues with newer Node.js versions or security vulnerabilities in its dependencies.
fix
Use caution when deploying in production. Regularly check for known vulnerabilities in its transitive dependencies (`npm audit`). Consider using a more actively maintained alternative for critical applications.
affects: >=1.0.0
gotchabrowserify-server provides basic static file serving and bundling, but lacks advanced development features such as Hot Module Replacement (HMR), live reloading, or sophisticated middleware support found in modern dev servers.
fix
For enhanced developer experience, integrate a separate live-reloading tool or switch to a modern bundler with an integrated dev server (e.g., Webpack Dev Server, Vite).
affects: >=1.0.0
Errors
Common errors & fixes
ReferenceError: require is not defined in ES module scope
Attempting to use `require()` in an ES Module (ESM) context when `browserify-server` is a CommonJS module.
fix
Either convert your project to CommonJS (e.g., by changing `type: 'module'` in `package.json` to `type: 'commonjs'` or removing it), or use a bundler/server that natively supports ESM.
TypeError: handler is not a function
The `require('browserify-server')` call returns a function that expects a `staticPath` argument. If called without `()` or with an invalid path, it might not return the expected handler.
fix
Ensure you call `require('browserify-server')` with the path to your static files, e.g., `const handler = require('browserify-server')('./static');`.
Error: listen EADDRINUSE: address already in use :::8080
Another process is already using the specified port (e.g., 8080).
fix
Stop the conflicting process or choose a different port for your `browserify-server` instance. You can set `process.env.PORT` or hardcode a different port.
Upgrade
Version history
2.1.18latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
4
OpenAI (training)
1
Resources
browserify-server — npm install browserify-server · libregistry