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.
Common errors
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.
Warnings
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.
Install
npm install namespace-bundler yarn add namespace-bundler pnpm add namespace-bundler Imports
- default wrong
import Bundler from 'namespace-bundler'correctconst Bundler = require('namespace-bundler') - bundle wrong
const { bundle } = require('namespace-bundler')correctconst Bundler = require('namespace-bundler'); Bundler.bundle('/path') - value wrong
const { value } = require('namespace-bundler').bundle('/path')correctconst result = require('namespace-bundler').bundle('/path'); result.value
Quickstart
const Bundler = require('namespace-bundler');
const result = Bundler.bundle('/path/to/src');
console.log(result.value);
result.writeToFile('/path/to/output.js');