{"id":12901,"library":"bob-the-bundler","title":"Bob The Bundler","description":"Bob The Bundler is a TypeScript build and bundle tool designed primarily for monorepos, widely used by The Guild's open-source projects. Its current stable version is 7.0.1, with major releases introducing breaking changes, often around module systems and Node.js compatibility. Key features include building ESM and CommonJS compatible npm packages, verifying module imports for usability, and enabling incremental builds for performance in monorepo setups. It supports pnpm workspaces and offers configurable TypeScript `tsconfig` paths. Bob emphasizes a strict, convention-based approach to bundling, providing a robust solution for complex JavaScript/TypeScript projects that require precise control over build outputs and types.","status":"active","version":"7.0.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/kamilkisiela/bob","tags":["javascript","typescript"],"install":[{"cmd":"npm install bob-the-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add bob-the-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add bob-the-bundler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for type checking and compilation during the build process.","package":"typescript","optional":false}],"imports":[{"note":"Bob The Bundler transitioned to ESM-only since v5.0.0. CommonJS `require()` is not supported for programmatic imports.","wrong":"const { build } = require('bob-the-bundler');","symbol":"build","correct":"import { build } from 'bob-the-bundler';"},{"note":"Used for setting up watch mode during development. ESM-only import.","wrong":null,"symbol":"watch","correct":"import { watch } from 'bob-the-bundler';"},{"note":"Helper function for programmatically creating Bob configuration objects. ESM-only import.","wrong":null,"symbol":"createConfig","correct":"import { createConfig } from 'bob-the-bundler';"}],"quickstart":{"code":"import { build } from 'bob-the-bundler';\nimport path from 'node:path';\n\nconst projectRoot = process.cwd();\n\n// Example: Programmatically building a project\nasync function runBuild() {\n  try {\n    console.log('Starting Bob build...');\n    await build({\n      cwd: projectRoot,\n      // You can specify an array of entry points or glob patterns\n      entry: ['src/index.ts', 'src/utils/**/*.ts'],\n      // Define output formats (e.g., esm, cjs)\n      format: ['esm', 'cjs'],\n      // Specify the output directory\n      outDir: 'dist',\n      // Use 'tsconfig.build.json' by default, or fallback to 'tsconfig.json'\n      tsconfig: path.join(projectRoot, 'tsconfig.build.json'),\n      // Example of enabling watch mode (for a dev server scenario)\n      // watch: false,\n      // Add more configuration as needed based on your project structure\n      // For example, splitting chunks, defining externals, etc.\n    });\n    console.log('Bob build completed successfully!');\n  } catch (error) {\n    console.error('Bob build failed:', error);\n    process.exit(1);\n  }\n}\n\nrunBuild();\n\n// CLI usage example (typically in package.json scripts):\n// {\n//   \"scripts\": {\n//     \"build\": \"bob build\",\n//     \"watch\": \"bob watch\"\n//   }\n// }","lang":"typescript","description":"Demonstrates programmatic usage of Bob The Bundler to build a TypeScript project, including common configuration options like entry points, output formats, and `tsconfig` path. It also hints at typical CLI usage."},"warnings":[{"fix":"Remove `bob runify` from your build scripts and adopt alternative tools or custom scripts for your specific task.","message":"The `bob runify` command has been removed in v7.0.0. Projects using this command must migrate to alternative build or script runners.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Upgrade your Node.js environment to version 16 or newer. Verify `engines.node` in your `package.json`.","message":"Bob The Bundler now requires Node.js version 16 or higher due to updates and reliance on modern JavaScript features.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Migrate programmatic imports from `const pkg = require('bob-the-bundler');` to `import * as pkg from 'bob-the-bundler';` or named imports like `import { build } from 'bob-the-bundler';`.","message":"Since v5.0.0, Bob The Bundler is bundled as an ES Module (ESM). Programmatic usage must now use `import` statements; `require()` for importing the library itself will result in an `ERR_REQUIRE_ESM` error.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Update your `package.json` exports map. For `require` entries, change `\"types\": \"./dist/typings/index.d.ts\"` to `\"types\": \"./dist/typings/index.d.cts\"`.","message":"Version 4.0.0 introduced a breaking change to the `package.json` exports map, requiring `.d.ts` type declarations for CommonJS `require` entries to be changed to `.d.cts`.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Ensure your build-specific TypeScript configuration is either in `tsconfig.build.json` or explicitly specified via a configuration option if you wish to use a different file.","message":"Beginning with v6.0.0, Bob The Bundler's build command prioritizes `tsconfig.build.json` as the default TypeScript configuration file, falling back to `tsconfig.json` if not found.","severity":"gotcha","affected_versions":">=6.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Change your import statement to use ES Modules syntax: `import { build } from 'bob-the-bundler';`.","cause":"Attempting to use CommonJS `require()` to import `bob-the-bundler` programmatically in Node.js versions >=5.0.0.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported."},{"fix":"Update your `package.json` scripts or build automation to remove calls to `bob runify`. Consider replacing it with `bob build` or a custom script.","cause":"`bob runify` command was removed in v7.0.0.","error":"Error: `bob runify` is not a bob command. Did you mean `bob build`?"},{"fix":"Upgrade your Node.js environment to version 16 or higher.","cause":"Running Bob The Bundler on a Node.js version older than 16.","error":"The current Node.js version (vX.Y.Z) is not supported. Please upgrade to Node.js >=16."},{"fix":"Install TypeScript in your project: `npm install typescript` or `pnpm add typescript`.","cause":"`typescript` is a peer dependency and must be explicitly installed in your project.","error":"Error: Cannot find module 'typescript' or similar TypeScript compilation errors."},{"fix":"If your `package.json` `exports` map specifies `require` for types, ensure it uses `.d.cts` for the declaration file, e.g., `\"types\": \"./dist/typings/index.d.cts\"`.","cause":"Incorrect TypeScript declaration path in `package.json`'s `exports` for `require` types (affected by v4.0.0 breaking change).","error":"TS2307: Cannot find module 'bob-the-bundler/dist/typings/index.d.ts' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"bob"}