Monopack
raw JSON → 0.2.6 verified Sat Apr 25 auth: no javascript abandoned
Monopack is a JavaScript bundler for Node.js monorepo applications that produces a single deterministic deliverable bundle including main.js, package.json, yarn.lock, and node_modules. Version 0.2.6 (last release) is in alpha stage with no recent updates. It distinguishes itself from generic bundlers by focusing on monorepo workflows and generating a deployable artifact with only used third-party dependencies. Requires Node.js >= 6.14.4 and Yarn >= 1.3.2.
Common errors
error Error: Cannot find module 'yarn' ↓
cause Yarn is not installed globally.
fix
Run 'npm install -g yarn' before using Monopack.
error Error: Unable to determine monorepo root ↓
cause Monopack expects a monorepo structure with lerna or yarn workspaces; project lacks configuration.
fix
Initialize a monorepo with Lerna (lerna init) or Yarn workspaces (add "workspaces" to package.json).
error Error: ENOENT: no such file or directory, open 'package.json' ↓
cause Running monopack in a directory without package.json.
fix
Ensure the current directory contains a valid package.json.
Warnings
gotcha Monopack requires Yarn to be installed globally, even if the project uses npm; otherwise dependency collection may be non-deterministic. ↓
fix Install Yarn via 'npm install -g yarn' before using Monopack.
deprecated Monopack is in alpha and the repository has not been updated since 2018; consider using alternatives like Nx or Turborepo. ↓
fix Migrate to a modern monorepo tool like Nx (nx.dev) or Turborepo (turbo.build).
gotcha Node.js version must be >= 6.14.4; using older versions will break. ↓
fix Upgrade Node.js to a supported version (>= 6.14.4).
Install
npm install monopack-dependency-collector yarn add monopack-dependency-collector pnpm add monopack-dependency-collector Imports
- build wrong
require('monopack').build()correctmonopack build main.js
Quickstart
npm install -g monopack
mkdir my-app && cd my-app
npm init -y
# create main.js with require statements
echo "module.exports = { app: 'monorepo-app' };" > main.js
monopack build main.js --out-dir ./dist
# or with extra modules
monopack build main.js -m mysql -m pg --out-dir ./dist