{"id":12893,"library":"bit-bundler","title":"Bit-Bundler","description":"Bit-Bundler is a JavaScript bundler designed for web applications, offering features like custom bundle output for advanced circular dependency handling across bundle splits since version 12.0.0. Initially, it used `browser-pack` but transitioned to a custom bundler. It supports various input types, including globs and objects with content, path, and name fields for module resolution. The package prioritizes ease of use for bundling directly supplied content strings or buffers. The latest specified version is 11.0.2, though version 12.1.2 was released in 2019. The project appears to be in an abandoned state, with no significant activity or releases since 2019, making it less suitable for new, actively developed projects. Its primary interface is through CommonJS `require` statements, which might not align with modern ESM-first development.","status":"abandoned","version":"11.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/MiguelCastillo/bit-bundler","tags":["javascript","bundler"],"install":[{"cmd":"npm install bit-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add bit-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add bit-bundler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Bit-Bundler primarily uses CommonJS `require` syntax. There is no documented or apparent ESM support.","wrong":"import Bitbundler from 'bit-bundler';","symbol":"Bitbundler","correct":"const Bitbundler = require('bit-bundler');"},{"note":"The primary `bundle` function is accessed as a method on the `Bitbundler` object obtained via `require`.","wrong":"import { bundle } from 'bit-bundler';","symbol":"bundle","correct":"const Bitbundler = require('bit-bundler');\nBitbundler.bundle({});"}],"quickstart":{"code":"const Bitbundler = require('bit-bundler');\nconst path = require('path');\nconst fs = require('fs');\n\nconst projectRoot = path.resolve(__dirname, 'temp_bit_bundler_project');\nconst srcDir = path.join(projectRoot, 'src');\nconst distDir = path.join(projectRoot, 'dist');\n\n// Create a temporary project structure for demonstration\nfs.mkdirSync(srcDir, { recursive: true });\nfs.mkdirSync(distDir, { recursive: true });\n\nfs.writeFileSync(path.join(srcDir, 'hello.js'), 'module.exports = () => \"Hello\";');\nfs.writeFileSync(path.join(srcDir, 'world.js'), 'module.exports = () => \"World\";');\n\nBitbundler.bundle({\n  src: path.join(srcDir, 'entry.js'),\n  dest: path.join(distDir, 'out.js'),\n  content: `\n    const hello = require(\"./hello\");\n    const world = require(\"./world\");\n    console.log(hello() + \" + \" + world());\n  `,\n  // Suppress logging for cleaner output in quickstart\n  log: false\n}).then(() => {\n  console.log('Bit-Bundler successfully created bundle!');\n  // You can optionally run the bundled file to verify\n  const bundledCode = fs.readFileSync(path.join(distDir, 'out.js'), 'utf-8');\n  // console.log('\\nBundled Output:\\n', bundledCode);\n  // For demonstration, cleanup temporary files\n  fs.rmSync(projectRoot, { recursive: true, force: true });\n}).catch(err => {\n  console.error('Bit-Bundler failed:', err);\n  fs.rmSync(projectRoot, { recursive: true, force: true });\n});","lang":"javascript","description":"This quickstart demonstrates how to bundle inline JavaScript content with Bit-Bundler, creating a basic output file. It showcases the `content` option introduced in v10 and uses the `bundle` API."},"warnings":[{"fix":"Review your existing bundling configurations and output expectations. Test thoroughly after upgrading to v12 to ensure compatibility, especially if you relied on specific `browser-pack` behaviors.","message":"Version 12.0.0 introduced a significant change by moving from `browser-pack` to a custom bundler. This impacts the internal bundling process and output structure, particularly for handling circular dependencies across bundle splits. While aiming to improve, it could potentially alter edge-case behaviors.","severity":"breaking","affected_versions":">=12.0.0"},{"fix":"Update your bundling configuration to use `content: '...'` instead of `contents: '...'`. For example, `Bitbundler.bundle({ dest: 'out.js', content: '...' })`.","message":"In version 10.0.0, the property name for providing inline content to bundle was changed from `contents` to `content`. Using `contents` on versions 10.0.0 and later will lead to the content not being bundled.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Ensure your project is configured to use CommonJS modules if integrating Bit-Bundler. If your project is ESM-first, you might need a transpilation step or consider alternative bundlers that natively support ESM.","message":"Bit-Bundler primarily supports and is documented with CommonJS `require()` syntax. It does not appear to offer native ESM `import` support, which is a significant limitation for modern JavaScript projects.","severity":"gotcha","affected_versions":">=9.0.0"},{"fix":"For new projects or existing projects requiring active maintenance, consider migrating to a actively developed bundler. If you must use `bit-bundler`, thoroughly audit its dependencies and usage for potential security vulnerabilities.","message":"The `bit-bundler` project appears to be abandoned, with its last significant commit and release (v12.1.2) occurring in 2019. This means it no longer receives security updates, bug fixes, or feature enhancements, posing a risk for long-term projects.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure your environment supports CommonJS modules, or use a tool like Babel or Webpack to transpile your ESM code to CommonJS before bundling. Alternatively, consider using a bundler with native ESM support.","cause":"Attempting to use `require('bit-bundler')` in an ES Module context without proper configuration or transpilation.","error":"ReferenceError: require is not defined"},{"fix":"Verify that you are using `const Bitbundler = require('bit-bundler');` to correctly import the module. Avoid `import { Bitbundler } from 'bit-bundler';` as it's not designed for named ESM imports.","cause":"This usually happens when `bit-bundler` is imported incorrectly, or `Bitbundler` is not correctly assigned the module export.","error":"TypeError: Bitbundler.bundle is not a function"},{"fix":"Check your bundler configuration. If using v10.0.0 or higher, change `contents: 'your code'` to `content: 'your code'`.","cause":"For versions 10.0.0 and later, the configuration property to provide inline content was renamed from `contents` to `content`.","error":"Bundling operation does not include specified content."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}