node-bundle
raw JSON → 1.0.999 verified Sat Apr 25 auth: no javascript
A fast bundler for CommonJS applications, version 1.0.999. No release cadence noted. Differentiators vs alternatives like webpack or esbuild: minimal configuration, focused solely on CommonJS (CJS) module bundles for Node.js environments. Not actively maintained based on README absence.
Common errors
error Error: Cannot find module 'node-bundle' ↓
cause Package not installed or incorrect import syntax.
fix
Run
npm install node-bundle and use const bundle = require('node-bundle'); error TypeError: bundle is not a function ↓
cause Incorrect import (e.g., used import instead of require, or got wrong export).
fix
Use correct CommonJS require:
const bundle = require('node-bundle'); Warnings
gotcha Only supports CommonJS modules, not ESM. ↓
fix Ensure all source files use require/module.exports; do not use import/export.
gotcha Output is always a single file; does not support code splitting. ↓
fix Use webpack or esbuild for code splitting.
gotcha No TypeScript support; treats .ts files as .js. ↓
fix Compile TypeScript to JavaScript first, then bundle.
Install
npm install node-bundle yarn add node-bundle pnpm add node-bundle Imports
- node-bundle wrong
import bundle from 'node-bundle';correctconst bundle = require('node-bundle'); - Bundle wrong
import { Bundle } from 'node-bundle';correctconst { Bundle } = require('node-bundle'); - bundle wrong
import bundle from 'node-bundle'; bundle();correctconst bundle = require('node-bundle'); bundle.bundle(...);
Quickstart
const bundle = require('node-bundle');
bundle({
entry: './src/index.js',
output: './dist/bundle.js'
}).then(result => {
console.log('Bundled:', result.size);
}).catch(err => console.error(err));