Monopack

raw JSON →
0.2.6 verified Sat Apr 25 auth: no javascript

Monopack is a JavaScript bundler designed for Node.js monorepo applications, currently in alpha (v0.2.6). It produces a single deterministic deliverable bundle (main.js), along with a filtered package.json, yarn.lock, and node_modules containing only used third-party dependencies. It targets developers using monorepos (e.g., Lerna) and CI/CD pipelines. Unlike generic bundlers like Webpack, Monopack specifically focuses on Node.js environments and deterministic builds. Release cadence is low; the project appears to be in early alpha with no recent major updates.

error Error: Cannot find module 'monopack'
cause Monopack is not installed locally or globally.
fix
Install monopack: npm install -g monopack (global) or npm install --save-dev monopack (local then npx monopack)
error Error: Yarn must be installed to proceed.
cause Yarn is required for post-build installation but not found in PATH.
fix
Install Yarn globally: npm install -g yarn
error Error: Dynamic require detected: ...
cause Monopack encountered a dynamic require() that it cannot resolve; dependency may be missing in the final bundle.
fix
Use the --with-extra-module option to manually add the dynamic dependency, e.g., monopack build main.js -m <package-name>
gotcha Alpha quality: the tool is in early alpha; may have bugs, breaking changes, or incomplete features.
fix Use at your own risk; pin to a specific version and test thoroughly.
gotcha Yarn required for deterministic builds: even though the project may use npm, Yarn must be installed globally for dependency installation.
fix Install Yarn: npm install -g yarn
gotcha Only detects static imports; dynamic require() dependencies may be missed, leading to runtime errors.
fix Use --with-extra-module flag to manually include dynamic dependencies, e.g., monopack build main.js -m mysql
gotcha Node.js >=6.14.4 required; older versions not supported.
fix Upgrade Node.js to at least v6.14.4.
gotcha Lockfile must be present in project root for deterministic dependency collection.
fix Ensure yarn.lock or package-lock.json exists in the monorepo root.
npm install monopack-process
yarn add monopack-process
pnpm add monopack-process

Global installation, building a monorepo app entry point to a dist directory, and running it.

// Install globally: npm install -g monopack
mkdir my-monorepo-app && cd my-monorepo-app
# Assumes a monorepo with a main.js entry
monopack build main.js --out-dir ./dist
# Output: dist/main.js, dist/package.json, dist/yarn.lock, dist/node_modules
# To run immediately:
monopack run main.js