Bundlib is an automatic library bundler built on top of Rollup.js, designed to streamline the process of packaging JavaScript and TypeScript libraries. The current stable version is 0.21.9, with active development indicated by frequent patch releases (0.21.9, 0.21.8, 0.21.7, etc.) that introduce new features like parallel builds and improved CLI commands, alongside bug fixes. It aims to simplify Rollup configuration for common library bundling scenarios, offering both automatic configuration derived from `package.json` and advanced programmatic or file-based configuration via `defineConfig`. A key differentiator is its focus on opinionated defaults to reduce setup complexity, while still allowing fine-grained control for various build types (ESM, CJS, UMD, types). Users should note that while powerful, the project is explicitly stated to be "under development," suggesting potential for evolving APIs or unresolved edge cases. It ships with TypeScript types and requires Node.js >=18.
npm install bundlibVerified import paths — ran on the pinned version, not inferred.
Demonstrates defining a multi-format library configuration using `defineConfig` in a `bundlib.config.ts` file, and shows how to invoke the build via the CLI in `package.json`.
Monitor official releases and changelogs closely for updates. Consider pinning to minor versions and thoroughly testing updates in a staging environment.
Upgrade your Node.js environment to version 18 or newer using tools like `nvm` or by installing a recent Node.js distribution.
Refer to the updated documentation or run `bundlib --help` to understand the correct CLI syntax for `build` and `watch` commands. Ensure your `package.json` scripts are updated accordingly.
Always test new Bundlib versions thoroughly, especially if you rely on specific Rollup plugins or complex build configurations. Consult the Rollup plugin's changelogs for breaking changes when updating Bundlib.
Ensure you are using ESM `import` statements (e.g., `import { defineConfig } from 'bundlib';`). For TypeScript, verify `moduleResolution` in `tsconfig.json` supports modern ESM (e.g., `"node16"` or `"bundler"`).Update your Node.js environment to version 18 or newer. Use `nvm install 18` and `nvm use 18` or similar version management tools.
Ensure your `bundlib.config.ts` or `package.json` configuration explicitly defines the `input` option, pointing to your library's main source file (e.g., `input: 'src/index.ts'`).
Use named import: `import { defineConfig } from 'bundlib';`. If using CommonJS, ensure your setup correctly transpiles ESM or update to an ESM-compatible environment.