{"id":17538,"library":"commonjs-everywhere","title":"CommonJS Everywhere Bundler","description":"commonjs-everywhere (cjsify) is a browser bundler designed for CommonJS modules, providing features like source map generation from minified bundles back to original source code, module aliasing for browser-specific overrides, and an extensible architecture to support various compile-to-JavaScript languages. Its current stable version is 0.9.7, and it appears to be unmaintained given its reliance on Node.js 0.8.x, 0.9.x, or 0.10.x (versions that were released over a decade ago and are long End-of-Life). Key differentiators in its time included robust source map support from minified to original sources, the ability to define custom handlers for non-JavaScript files (such as CoffeeScript and JSON, which were included by default), and an efficient watch mode that only rebuilt changed dependencies. It served as an early alternative to tools like Browserify for enabling Node.js-style module loading in browser environments.","status":"abandoned","version":"0.9.7","language":"javascript","source_language":"en","source_url":"git://github.com/michaelficarra/commonjs-everywhere","tags":["javascript","CommonJS","CommonJS Everywhere","browser","build","bundle","cjsify","browserify","dependency resolution"],"install":[{"cmd":"npm install commonjs-everywhere","lang":"bash","label":"npm"},{"cmd":"yarn add commonjs-everywhere","lang":"bash","label":"yarn"},{"cmd":"pnpm add commonjs-everywhere","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only and only supports Node.js versions 0.8.x, 0.9.x, and 0.10.x.","wrong":"import { cjsify } from 'commonjs-everywhere';","symbol":"cjsify","correct":"const cjsify = require('commonjs-everywhere');"},{"note":"While a global install (`npm install -g commonjs-everywhere`) would allow `cjsify` directly, `npx` is recommended for running the CLI without global installation. The CLI binary is `cjsify`.","wrong":"commonjs-everywhere <options>","symbol":"CLI","correct":"npx commonjs-everywhere <options>"}],"quickstart":{"code":"# Create dummy files for demonstration\nmkdir -p cjs-app/src\necho 'module.exports = \"Hello from dep!\";' > cjs-app/src/dep.js\necho 'const dep = require(\"./dep\"); module.exports = () => `Main output: ${dep}`;' > cjs-app/src/entry-file.js\n\n# Navigate into the app directory\ncd cjs-app\n\n# Bundle the entry file, export 'MyLibrary', and create a source map\n# This will output the bundled code to stdout\nnpx commonjs-everywhere src/entry-file.js --export MyLibrary --source-map my-library.js.map >my-library.js\n\n# To see the output\ncat my-library.js\ncat my-library.js.map\n\n# Clean up (optional)\ncd ..\nrm -rf cjs-app","lang":"bash","description":"Demonstrates bundling a simple CommonJS application using the `cjsify` CLI, exporting a global variable, and generating a source map."},"warnings":[{"fix":"Use a compatible Node.js version (e.g., via `nvm`) if absolutely necessary, but migration to a modern bundler is strongly recommended.","message":"The package is explicitly compatible only with very old Node.js versions (0.8.x, 0.9.x, 0.10.x). It is highly unlikely to run on modern Node.js versions without significant issues or failure.","severity":"breaking","affected_versions":">=0.9.7"},{"fix":"Migrate to a contemporary JavaScript bundler such as Webpack, Rollup, Parcel, or esbuild for new projects and consider migrating existing projects away from this tool.","message":"commonjs-everywhere is no longer actively maintained. The last release was several years ago, and its dependencies and underlying technologies are outdated.","severity":"abandoned","affected_versions":">=0.9.7"},{"fix":"Install `escodegen` (`npm install escodegen`) and use it to generate code: `const bundledCode = escodegen.generate(ast);`","message":"When using the programmatic interface (`cjsify(entryPoint, root, options)`), the function returns a SpiderMonkey AST (Abstract Syntax Tree), not executable JavaScript code. You must use a separate tool like `escodegen` to convert the AST into a JavaScript string.","severity":"gotcha","affected_versions":">=0.9.0"},{"fix":"Avoid using this package for new development. For existing projects, perform a thorough security audit or, preferably, migrate to a actively maintained and secure bundling solution.","message":"Using unmaintained software, especially build tools, can introduce security vulnerabilities through unpatched dependencies, deprecated APIs, or inherent flaws that will not receive updates.","severity":"gotcha","affected_versions":">=0.9.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Ensure `commonjs-everywhere` is installed locally (`npm install commonjs-everywhere`) or globally (`npm install -g commonjs-everywhere`). Check the `require()` path for accuracy.","cause":"The package is not installed or the `require()` path is incorrect.","error":"Error: Cannot find module 'commonjs-everywhere'"},{"fix":"Ensure you are running the code in a Node.js environment or that the bundled output includes the necessary CommonJS shim. If using the programmatic interface, ensure you are calling `cjsify` and then processing its output. If you tried to use `import`, switch to `const cjsify = require('commonjs-everywhere');`.","cause":"Attempting to use CommonJS `require()` in an environment that does not define it (e.g., a browser without a bundler's shim), or using `import` syntax where `require()` is expected.","error":"Error: 'require' not defined"},{"fix":"This package is strictly CommonJS. Use `const cjsify = require('commonjs-everywhere');` instead of `import`.","cause":"Attempting to use ES Modules `import` syntax with this CommonJS-only package, or in a Node.js environment not configured for ESM.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}