Mono Bundler
raw JSON → 1.43.92 verified Sat Apr 25 auth: no javascript
Monorepo bundler based on rollup.js and vercel/ncc. Current stable version 1.43.92 supports configurable workspace packages, loader file generation, hash file names, and legacy browser support via Babel polyfills. It wraps rollup and ncc to provide a unified configuration for monorepos with glob-based package discovery. Maintained by hoevelmanns. Release cadence is irregular; latest version from 2024. Differentiator: bundler integration for monorepos that avoids manual per-package rollup configs, but remains experimental and may lack community adoption compared to tools like Nx or Turborepo.
Common errors
error Error: Cannot find module 'mono-bundler' ↓
cause Package not installed or ESM resolution issue.
fix
Run
npm install mono-bundler and ensure package.json has 'type': 'module'. error TypeError: monoBundler is not a function ↓
cause Imported via require() but package is ESM-only.
fix
Change to
import monoBundler from 'mono-bundler' and use ESM context. error Error: The 'legacyBrowserSupport' option is deprecated. Please configure Babel manually. ↓
cause Using deprecated legacyBrowserSupport option.
fix
Remove legacyBrowserSupport from config and add @rollup/plugin-babel.
Warnings
breaking The package is experimental; breaking changes may occur without major version bump. ↓
fix Lock to patch version and review changelog before upgrading.
deprecated legacyBrowserSupport option will be removed in v2.0.0; use babel config directly. ↓
fix Remove legacyBrowserSupport and add @rollup/plugin-babel manually.
gotcha Requires Node >=10, but some features need Node >=14 due to ESM usage. ↓
fix Use Node >=14 when using ESM imports or modern rollup plugins.
gotcha hashFileNames generates long hashes; clear cache after each build to avoid stale files. ↓
fix Run `rm -rf dist` before each build or use rollup's 'clean' output option.
gotcha When using pnpm workspaces, glob patterns may not find packages correctly. ↓
fix Use absolute paths or relative from root; consider using 'packages: ['.']' as fallback.
Install
npm install mono-bundler yarn add mono-bundler pnpm add mono-bundler Imports
- default wrong
const monoBundler = require('mono-bundler')correctimport monoBundler from 'mono-bundler' - defineConfig
import { defineConfig } from 'mono-bundler' - BundleConfig wrong
import { BundleConfig } from 'mono-bundler'correctimport type { BundleConfig } from 'mono-bundler'
Quickstart
// mono.config.js
export default {
packages: ['packages/*'],
createLoaders: true,
hashFileNames: true,
legacyBrowserSupport: false,
plugins: [],
// rollup input
input: 'src/index.js',
output: {
dir: 'dist',
format: 'esm'
}
};
// Run: mono -c