Registry / web-framework / commonjs-everywhere

commonjs-everywhere

JSON →
library0.9.7jsnpmunverified

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.

npm install commonjs-everywhere
INSTALL
IMPORT
SIG · COMMONJS-EVERYWHER
C
commonjs-everywhere
web-frameworkjavascriptv0.9.7
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.

cjsify
const cjsify = require('commonjs-everywhere');
import { cjsify } from 'commonjs-everywhere';
This package is CommonJS-only and only supports Node.js versions 0.8.x, 0.9.x, and 0.10.x.
CLI
npx commonjs-everywhere <options>
commonjs-everywhere <options>
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`.

Demonstrates bundling a simple CommonJS application using the `cjsify` CLI, exporting a global variable, and generating a source map.

# Create dummy files for demonstration mkdir -p cjs-app/src echo 'module.exports = "Hello from dep!";' > cjs-app/src/dep.js echo 'const dep = require("./dep"); module.exports = () => `Main output: ${dep}`;' > cjs-app/src/entry-file.js # Navigate into the app directory cd cjs-app # Bundle the entry file, export 'MyLibrary', and create a source map # This will output the bundled code to stdout npx commonjs-everywhere src/entry-file.js --export MyLibrary --source-map my-library.js.map >my-library.js # To see the output cat my-library.js cat my-library.js.map # Clean up (optional) cd .. rm -rf cjs-app
cjsify --version
Debug
Known issues
breakingThe 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.
fix
Use a compatible Node.js version (e.g., via `nvm`) if absolutely necessary, but migration to a modern bundler is strongly recommended.
affects: >=0.9.7
abandonedcommonjs-everywhere is no longer actively maintained. The last release was several years ago, and its dependencies and underlying technologies are outdated.
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.
affects: >=0.9.7
gotchaWhen 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.
fix
Install `escodegen` (`npm install escodegen`) and use it to generate code: `const bundledCode = escodegen.generate(ast);`
affects: >=0.9.0
gotchaUsing unmaintained software, especially build tools, can introduce security vulnerabilities through unpatched dependencies, deprecated APIs, or inherent flaws that will not receive updates.
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.
affects: >=0.9.0
Errors
Common errors & fixes
Error: Cannot find module 'commonjs-everywhere'
The package is not installed or the `require()` path is incorrect.
fix
Ensure `commonjs-everywhere` is installed locally (`npm install commonjs-everywhere`) or globally (`npm install -g commonjs-everywhere`). Check the `require()` path for accuracy.
Error: 'require' not defined
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.
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');`.
SyntaxError: Cannot use import statement outside a module
Attempting to use ES Modules `import` syntax with this CommonJS-only package, or in a Node.js environment not configured for ESM.
fix
This package is strictly CommonJS. Use `const cjsify = require('commonjs-everywhere');` instead of `import`.
Upgrade
Version history
0.9.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
commonjs-everywhere — npm install commonjs-everywhere · libregistry