{"library":"monosize-bundler-esbuild","title":"esbuild Bundler for Monosize","description":"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.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install monosize-bundler-esbuild"],"cli":null},"imports":["import esbuildBundler from 'monosize-bundler-esbuild';","import esbuildBundler from 'monosize-bundler-esbuild';\nexport default {\n  bundler: esbuildBundler(config => { /* customize */ return config; })\n};"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import esbuildBundler from 'monosize-bundler-esbuild';\n\nexport default {\n  // Define your entry points for monosize to measure\n  fixtures: {\n    'my-component-bundle': 'src/my-component.ts',\n    'another-lib': 'src/another-lib/index.js'\n  },\n  // Configure the esbuild bundler plugin\n  bundler: esbuildBundler(config => {\n    // Example: Add a loader for SVG files if your components import them\n    config.loader = {\n      ...config.loader,\n      '.svg': 'file',\n    };\n    // Example: Define some global constants\n    config.define = {\n      ...config.define,\n      'process.env.NODE_ENV': JSON.stringify('production'),\n    };\n    // Always return the (potentially modified) config\n    return config;\n  }),\n  // Other monosize configurations...\n  output: {\n    directory: './monosize-results'\n  }\n};","lang":"typescript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}