v0.1.0 β Initial release
π Initial release
astro-bundle-budget is an Astro integration that audits your JS and CSS bundle sizes at build time β and optionally fails the build when you exceed your thresholds.
Features
- Per-file budgets β set size limits on individual assets using glob patterns
- Per-page budgets β limit the total JS/CSS payload a single page may reference
- Compression-aware β measure gzip or brotli wire sizes instead of raw bytes
- Dev Toolbar panel β live bundle stats visible inside
astro dev - JSON report β write
bundle-budget-report.jsontooutDirfor CI artefact diffing - Zero runtime dependencies β Node built-ins only
Install
npm install -D astro-bundle-budgetUsage
// astro.config.mjs
import bundleBudget from 'astro-bundle-budget'
export default defineConfig({
integrations: [
bundleBudget({
budgets: [
{ path: 'assets/vendor-*.js', budget: '50 kB' },
{ path: '**/*.js', budget: '100 kB' },
{ path: '**/*.css', budget: '20 kB' },
],
})
]
})