Registry / devops / bit-bundler-browserpack

bit-bundler-browserpack

JSON →
library4.0.2jsnpmunverified

bit-bundler-browserpack is a plugin for the bit-bundler asset bundling system, specifically designed for processing and packaging JavaScript assets. It leverages the robust browser-pack library as its core bundle generator, enabling bit-bundler to create browser-compatible JavaScript bundles. The package is currently at version 4.0.2 and serves as a primary mechanism for bit-bundler to handle JavaScript modules, supporting features like inline source map generation and UMD (Universal Module Definition) exports for broad environment compatibility (Node.js, RequireJS, traditional script tags). While it offers options to fine-tune browser-pack directly, it generally automates most configurations, ensuring seamless integration. Its release cadence is closely tied to bit-bundler's development, providing stability and compatibility within that ecosystem. It differentiates itself by providing a browser-pack powered backend within the bit-bundler framework, offering a tailored bundling solution for JavaScript source files.

npm install bit-bundler-browserpack
INSTALL
IMPORT
SIG · BIT-BUNDLER-BROWSE
B
bit-bundler-browserpack
devopsjavascriptv4.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.

Bundler Provider Reference
bundler: ['bit-bundler-browserpack', { sourceMap: true, umd: 'myBundleName' }]
import { BundlerProvider } from 'bit-bundler-browserpack';
This package is a bit-bundler plugin. It is not directly imported or required for its API. Instead, bit-bundler dynamically loads it when its package name string is specified within the bit-bundler configuration as a bundler provider.

Demonstrates how to configure and use bit-bundler-browserpack as the JavaScript bundler within a bit-bundler project, enabling source maps and UMD output.

import Bitbundler from 'bit-bundler'; import path from 'path'; // This example assumes 'src/index.js' and 'src/utils.js' exist. // E.g., src/index.js: `import { greet } from './utils'; greet('World');` // E.g., src/utils.js: `export function greet(name) { console.log(`Hello, ${name}!`); }` async function createJavaScriptBundle() { const bundler = new Bitbundler({ src: 'src/index.js', // Your application's entry point dest: 'dist/bundle.js', // Output bundle path // Specify bit-bundler-browserpack as the bundler provider // and pass configuration options to it. bundler: ['bit-bundler-browserpack', { sourceMap: true, // Generate inline source maps for easier debugging umd: 'myAwesomeApp', // Export as a UMD module accessible as 'myAwesomeApp' printInfo: true // Log basic module information during bundling }], // Additional Bit-bundler configurations, e.g., for module resolution resolve: { modules: ['node_modules', 'src'] // Resolve modules from node_modules and your 'src' directory } }); try { const result = await bundler.bundle(); console.log(`Bundle successfully created at ${result.dest}`); // You can now use 'node dist/bundle.js' or include it in a <script> tag. } catch (error) { console.error('Failed to create bundle:', error); process.exit(1); } } createJavaScriptBundle();
Debug
Known issues
breakingMajor version updates of the core bit-bundler package may introduce breaking changes that require corresponding updates or configuration adjustments in bit-bundler-browserpack.
fix
Always check the release notes for both bit-bundler and bit-bundler-browserpack when updating major versions. Ensure version compatibility.
affects: >=1.0.0
gotchaSource map generation (`sourceMap: true`) can be complex. If source maps are not working as expected, it might be due to incorrect paths, caching issues, or interactions with other build steps.
fix
Verify that sourceMap is enabled. Check browser developer tools for console errors related to source map loading. Ensure output paths are correct and there are no conflicting source map configurations in other tools.
affects: >=1.0.0
gotchaIncorrect or missing 'umd' configuration can lead to the bundled module being inaccessible or not behaving as expected in different environments (browser, Node.js, RequireJS).
fix
Carefully define the 'umd' option with a unique, valid global name if your bundle needs to be exposed globally. Test the bundle in all target environments (e.g., as a script tag, with `require()`).
affects: >=1.0.0
gotchaWhile direct 'browserPack' options can be passed, bit-bundler-browserpack generally computes optimal settings automatically. Overriding these directly without deep understanding can lead to unexpected bundling behavior or broken output.
fix
Avoid setting 'browserPack' options unless absolutely necessary. If you do, thoroughly test the output bundle across all target environments.
affects: >=1.0.0
breakingVersion 2.0.0 likely introduced significant breaking changes in configuration or output format compared to 1.0.0, common for early major version bumps in build tools.
fix
When upgrading from v1.x, consult any available release notes (even if unofficial) or migration guides for changes in configuration options and expected output.
affects: >=2.0.0
gotchaWhen used with `bit-bundler`'s watch mode for incremental builds, `bit-bundler-browserpack` can occasionally encounter caching issues or not correctly reflect changes if not properly configured or if external factors interfere.
fix
Ensure `bit-bundler`'s caching mechanisms are understood. In case of stale builds, a full rebuild might be necessary. Check for external file watchers or build systems that might interfere.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'bit-bundler-browserpack'
The package 'bit-bundler-browserpack' is not installed in the project's node_modules.
fix
Run `npm install bit-bundler-browserpack` or `yarn add bit-bundler-browserpack` in your project directory.
ReferenceError: myAwesomeApp is not defined
The UMD bundle was loaded, but the global variable specified by the 'umd' option is not accessible, usually due to incorrect loading order or a typo in the variable name.
fix
Verify that the UMD bundle is loaded correctly in your HTML (e.g., via a <script> tag) or Node.js environment, and that the global name you're trying to access matches the 'umd' option value exactly.
Source map error: request for https://... failed with status 404
The browser or debugger cannot find the source map file, usually because it's not being served or the path in the bundle's source map URL is incorrect.
fix
Ensure your web server is configured to serve `.map` files. If source maps are inline, verify that the `sourceMap: true` option is correctly applied and the bundle is being served correctly.
TypeError: Cannot read properties of undefined (reading 'bundle')
This error typically indicates that the 'bit-bundler' instance or its configuration object is not correctly initialized or the 'bundler' array is malformed.
fix
Double-check your `new Bitbundler({...})` call. Ensure `bit-bundler` is installed and the `bundler` array correctly specifies `['bit-bundler-browserpack', {...}]` with valid options.
Upgrade
Version history
4.0.2latest on npm
Audit
Dependencies
bit-bundlerrequiredThis package acts as a plugin/provider for bit-bundler and requires it to operate. It is typically a peer dependency.
browser-packrequiredThe core bundling logic is provided by browser-pack, which this package wraps.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
bit-bundler-browserpack — npm install bit-bundler-browserpack · libregistry