Registry / web-framework / bit-bundler

bit-bundler

JSON →
library11.0.2jsnpmunverified

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.

npm install bit-bundler
INSTALL
IMPORT
SIG · BIT-BUNDLER
B
bit-bundler
web-frameworkjavascriptv11.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Bitbundler
const Bitbundler = require('bit-bundler');
import Bitbundler from 'bit-bundler';
Bit-Bundler primarily uses CommonJS `require` syntax. There is no documented or apparent ESM support.
bundle
const Bitbundler = require('bit-bundler'); Bitbundler.bundle({});
import { bundle } from 'bit-bundler';
The primary `bundle` function is accessed as a method on the `Bitbundler` object obtained via `require`.

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.

const Bitbundler = require('bit-bundler'); const path = require('path'); const fs = require('fs'); const projectRoot = path.resolve(__dirname, 'temp_bit_bundler_project'); const srcDir = path.join(projectRoot, 'src'); const distDir = path.join(projectRoot, 'dist'); // Create a temporary project structure for demonstration fs.mkdirSync(srcDir, { recursive: true }); fs.mkdirSync(distDir, { recursive: true }); fs.writeFileSync(path.join(srcDir, 'hello.js'), 'module.exports = () => "Hello";'); fs.writeFileSync(path.join(srcDir, 'world.js'), 'module.exports = () => "World";'); Bitbundler.bundle({ src: path.join(srcDir, 'entry.js'), dest: path.join(distDir, 'out.js'), content: ` const hello = require("./hello"); const world = require("./world"); console.log(hello() + " + " + world()); `, // Suppress logging for cleaner output in quickstart log: false }).then(() => { console.log('Bit-Bundler successfully created bundle!'); // You can optionally run the bundled file to verify const bundledCode = fs.readFileSync(path.join(distDir, 'out.js'), 'utf-8'); // console.log('\nBundled Output:\n', bundledCode); // For demonstration, cleanup temporary files fs.rmSync(projectRoot, { recursive: true, force: true }); }).catch(err => { console.error('Bit-Bundler failed:', err); fs.rmSync(projectRoot, { recursive: true, force: true }); });
Debug
Known issues
breakingVersion 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.
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.
affects: >=12.0.0
breakingIn 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.
fix
Update your bundling configuration to use `content: '...'` instead of `contents: '...'`. For example, `Bitbundler.bundle({ dest: 'out.js', content: '...' })`.
affects: >=10.0.0
gotchaBit-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.
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.
affects: >=9.0.0
gotchaThe `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.
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.
affects: >=1.0.0
Errors
Common errors & fixes
ReferenceError: require is not defined
Attempting to use `require('bit-bundler')` in an ES Module context without proper configuration or transpilation.
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.
TypeError: Bitbundler.bundle is not a function
This usually happens when `bit-bundler` is imported incorrectly, or `Bitbundler` is not correctly assigned the module export.
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.
Bundling operation does not include specified content.
For versions 10.0.0 and later, the configuration property to provide inline content was renamed from `contents` to `content`.
fix
Check your bundler configuration. If using v10.0.0 or higher, change `contents: 'your code'` to `content: 'your code'`.
Upgrade
Version history
11.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
1
Resources
bit-bundler — npm install bit-bundler · libregistry