{"id":12916,"library":"browserify-server","title":"Browserify Server","description":"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.","status":"abandoned","version":"2.1.18","language":"javascript","source_language":"en","source_url":"git://github.com/Raynos/browserify-server","tags":["javascript"],"install":[{"cmd":"npm install browserify-server","lang":"bash","label":"npm"},{"cmd":"yarn add browserify-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add browserify-server","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import handler from 'browserify-server'","symbol":"handler","correct":"const handler = require('browserify-server')"},{"note":"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.","wrong":"import { BrowserifyServerHandler } from 'browserify-server'","symbol":"BrowserifyServerHandler","correct":"/** @typedef {function} BrowserifyServerHandler */\nconst handler = require('browserify-server')"},{"note":"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.","wrong":"import { createServer } from 'browserify-server/http'; // Or similar attempt to import internal Node modules via package","symbol":"createServer","correct":"const http = require('http');\nconst handler = require('browserify-server');\nconst server = http.createServer(handler);"}],"quickstart":{"code":"const handler = require(\"browserify-server\")(\"./static\");\nconst http = require(\"http\");\nconst path = require('path');\nconst fs = require('fs');\n\n// Create a dummy static directory and an index.html for the example\nconst staticPath = path.join(__dirname, 'static');\nif (!fs.existsSync(staticPath)) {\n  fs.mkdirSync(staticPath);\n}\nfs.writeFileSync(path.join(staticPath, 'index.html'), '<html><body><h1>Hello from browserify-server!</h1><script src=\"/bundle.js\"></script></body></html>');\nfs.writeFileSync(path.join(staticPath, 'index.js'), 'document.addEventListener(\\'DOMContentLoaded\\', () => console.log(\\'Bundle loaded!\\'));');\n\nconst server = http.createServer(handler);\nconst port = process.env.PORT ?? 8080;\n\nserver.listen(port, () => {\n  console.log(`HTTP server listening on port ${port}`);\n  console.log(`Open http://localhost:${port} in your browser.`);\n  console.log(`Access bundled JS at http://localhost:${port}/bundle.js`);\n});\n\n// Clean up static files after server closes (optional for quickstart)\nprocess.on('SIGINT', () => {\n  server.close(() => {\n    console.log('Server stopped. Cleaning up static files...');\n    fs.unlinkSync(path.join(staticPath, 'index.html'));\n    fs.unlinkSync(path.join(staticPath, 'index.js'));\n    fs.rmdirSync(staticPath);\n    process.exit(0);\n  });\n});","lang":"javascript","description":"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'."},"warnings":[{"fix":"Consider migrating to a project using Webpack Dev Server, Vite, or Parcel for a more modern and feature-rich development experience.","message":"The underlying Browserify technology, while functional, is largely superseded by modern bundlers like Webpack, Rollup, and Vite. New projects are unlikely to choose Browserify-server.","severity":"deprecated","affected_versions":">=1.0.0"},{"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.","message":"This package is a CommonJS module and does not support ES Modules (ESM) import syntax. Attempting to use `import` statements will result in runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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).","message":"browserify-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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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.","cause":"Attempting to use `require()` in an ES Module (ESM) context when `browserify-server` is a CommonJS module.","error":"ReferenceError: require is not defined in ES module scope"},{"fix":"Ensure you call `require('browserify-server')` with the path to your static files, e.g., `const handler = require('browserify-server')('./static');`.","cause":"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.","error":"TypeError: handler is not a function"},{"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.","cause":"Another process is already using the specified port (e.g., 8080).","error":"Error: listen EADDRINUSE: address already in use :::8080"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"browserify-server"}