bit-bundler-splitter is a plugin for the bit-bundler module bundler, designed to segment application code into smaller, optimized bundles, often referred to as 'bundle shards.' Its primary use case is to separate third-party vendor modules from application-specific code, leveraging browser caching for improved performance and reduced network traffic for returning visitors. The current stable version is 7.0.0, indicating continued development despite a non-fixed release cadence. Key differentiators include its flexible matching rules, powered by `roolio`, which allow granular control over module placement based on path, filename, or other properties. It automatically generates a `common` bundle to prevent module duplication across different shards and a `loader` bundle to manage the correct loading order of bundles in the browser. Furthermore, it supports building a sophisticated bundle tree for better dependency resolution and includes mechanisms for detecting circular references between generated bundles, contributing to a robust bundling strategy.
npm install bit-bundler-splitterVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure `bit-bundler-splitter` as a plugin within `bit-bundler` to split vendor and renderer-specific modules into separate output files, including basic error handling.
Refactor plugin configurations from `['bit-bundler-splitter', 'my-name', {...}]` to `['bit-bundler-splitter', { name: 'my-name', ... }]`.Carefully review the `v5.0.0` release notes and documentation to update your bundle configuration, paying close attention to bundle loading, tree construction, and how circular references are handled in your specific setup.
Upgrade `bit-bundler-splitter` to `v5.0.1` or higher. Ensure all necessary Babel peer dependencies (e.g., `@babel/core`, `@babel/preset-env`) are explicitly installed in your project's `devDependencies`.
Configure `bit-bundler-splitter` using an options object that includes a `name` property: `['bit-bundler-splitter', { name: 'vendor', dest: 'dist/vendor.js', match: [...] }]`.Use CommonJS `require` for the default export: `const splitBundle = require('bit-bundler-splitter');`Install the required Babel packages as dev dependencies: `npm install --save-dev @babel/core @babel/preset-env` and ensure `bit-bundler-splitter` is at least `v5.0.1`.