This package provides an `esbuild`-based bundler plugin for the `monosize` package size measurement tool. It enables `monosize` to use `esbuild` for creating optimized bundles, allowing developers to accurately assess the size implications of their code using a high-performance bundler. The current stable version is 0.3.2, and its release cadence is typically tied to updates in `monosize` or `esbuild` itself. Key differentiators include its seamless integration into the `monosize.config.mjs` setup, support for `esbuild`'s full configuration options via a callback, and optimized batch build modes for faster measurements compared to sequential builds. It leverages `esbuild`'s speed and efficiency to provide quick and reliable size reports.
npm install monosize-bundler-esbuildVerified import paths — ran on the pinned version, not inferred.
Shows how to configure `monosize.config.mjs` to use `monosize-bundler-esbuild`, including custom `esbuild` configuration such as adding a file loader for SVGs and defining environment variables.
Ensure your `monosize.config.js` is renamed to `monosize.config.mjs` and use `import` statements for all modules.
Wrap your `esbuild` configuration object within a function: `esbuildBundler(config => { /* modify config */ return config; })`.Install `esbuild` alongside this package: `npm install esbuild --save-dev` or `yarn add esbuild --dev`.
Run monosize with the `--build-mode=sequential` flag: `monosize measure --build-mode=sequential`.
Ensure your `monosize.config.js` is named `monosize.config.mjs` and use `import esbuildBundler from 'monosize-bundler-esbuild';`.
Modify your configuration to `bundler: esbuildBundler(config => { /* ... */ return config; })`.Install `esbuild` as a development dependency: `npm install esbuild --save-dev` or `yarn add esbuild --dev`.