namespace-bundler

raw JSON →
1.0.7 verified Sat Apr 25 auth: no javascript abandoned

A JavaScript bundler (v1.0.7, last updated 2017) that concatenates files following namespace patterns without requiring import/require statements. Designed for legacy browser support including IE8, it produces readable output in dev tools. Simple API with bundle() returning content and writeToFile() for synchronous output. No active development since 2017.

error Error: Cannot find module 'namespace-bundler'
cause Package not installed.
fix
npm install --save-dev namespace-bundler
error TypeError: Bundler.bundle is not a function
cause Wrong import style (ESM import used).
fix
Use const Bundler = require('namespace-bundler');
error Cannot read property 'value' of undefined
cause bundle() called with invalid path or empty directory.
fix
Ensure the path is absolute and contains JavaScript files.
gotcha No import/require in source files: the bundler relies on namespace pattern ordering.
fix Ensure files use namespace pattern (e.g., window.MyApp = window.MyApp || {};) for dependency order.
gotcha writeToFile is synchronous; may block event loop for large projects.
fix Use value property and write asynchronously with fs.writeFile if needed.
deprecated No updates since 2017; consider modern bundlers like webpack or esbuild.
fix Migrate to an actively maintained bundler.
npm install namespace-bundler
yarn add namespace-bundler
pnpm add namespace-bundler

Shows basic usage: bundle a directory and get content or write to file.

const Bundler = require('namespace-bundler');
const result = Bundler.bundle('/path/to/src');
console.log(result.value);
result.writeToFile('/path/to/output.js');