monosize-bundler-rspack is a specialized plugin for the `monosize` tool, designed to integrate Rspack as the underlying bundler for comprehensive JavaScript bundle size analysis. It allows developers to harness the high performance of Rspack for evaluating bundle sizes within large-scale monorepos or projects optimized for `monosize`. Currently at version 0.2.1, it is an actively developed component within the broader Microsoft `monosize` ecosystem. While exact release cadences are not strictly defined for this plugin, its early version number indicates ongoing development and potential for rapid evolution. A key differentiator is its default 'batch build mode,' which significantly enhances build speed (8-14x faster in typical scenarios) compared to sequential bundling, making it exceptionally well-suited for efficient monorepo size optimization. The plugin also provides an API to customize the underlying rsbuild configuration, offering flexibility for intricate build requirements.
npm install monosize-bundler-rspackVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates configuring `monosize.config.mjs` to use `monosize-bundler-rspack` as the bundler, including examples of customizing the underlying rsbuild configuration for aliases and module rules.
Always check the GitHub repository's release notes or changelog before upgrading for versions below 1.0.0.
To use sequential mode, run `monosize measure --build-mode=sequential`. This builds one fixture at a time, which can be helpful for debugging build-specific problems.
When customizing the configuration, make incremental changes and thoroughly test the output. Refer to the rsbuild documentation for valid configuration options. Utilize `console.log(config)` within the callback to inspect the default configuration before modification.
Ensure the package is installed as a dev dependency: `npm install --save-dev monosize-bundler-rspack` or `yarn add --dev monosize-bundler-rspack`.
Ensure your `monosize.config.mjs` uses `import rspackBundler from 'monosize-bundler-rspack';` and not `const rspackBundler = require(...)` or `import { rspackBundler } from '...'`. Also verify the file extension is `.mjs`.Carefully review the Rspack error messages for specifics. Debug your `monosize.config.mjs` customization by commenting out changes, and ensure all source files and their dependencies are correctly resolved and valid.