Bun-Bundler is a modern, ultra-fast asset bundler specifically designed for the Bun runtime environment, currently stable at version 0.2.12. It offers comprehensive capabilities for processing HTML (including Pug templating with includes and layouts), SCSS/CSS (with autoprefixing), JavaScript (bundling and minification via `Bun.build`), and static assets. Key features include SVG sprite generation, parallel image optimization with caching, and a development server with hot reload. It differentiates itself through its tight integration with Bun, leveraging Bun's speed and native APIs, and providing both a JavaScript API for advanced scripting and a zero-config-friendly CLI driven by JSON configuration files. Release cadence is rapid, reflecting its pre-1.0 development status, with potential for frequent API adjustments.
npm install bun-bundlerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a full production build workflow using the JavaScript API, including HTML (Pug), SCSS, JavaScript bundling, and post-build image optimization and SVG sprite generation.
Always review the release notes and migration guides (if available) when upgrading to a new version. Pin exact versions in `package.json` to prevent unexpected breakages.
Ensure Bun version 1.0.0 or greater is installed globally and that scripts are run using `bun run <script>`.
Use `import Bundler from 'bun-bundler';` for the main bundler, and `import { ImageProcessor, Server } from 'bun-bundler/modules';` for utilities.Install or upgrade Bun to version 1.0.0 or newer (e.g., `curl -fsSL https://bun.sh/install | bash` or `bun upgrade`).
Change your import statement to `import Bundler from 'bun-bundler';`.
Ensure that utility classes like `ImageProcessor`, `SpriteBuilder`, or `Server` are imported with the correct path: `import { ImageProcessor } from 'bun-bundler/modules';`.