Registry / devops / bun-bundler

bun-bundler

JSON →
library0.2.12jsnpmunverified

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-bundler
INSTALL
IMPORT
SIG · BUN-BUNDLER
B
bun-bundler
devopsjavascriptv0.2.12
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
install or import failed
glibc
node 18–223 runs
install or import failed
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Bundler
✓ import Bundler from 'bun-bundler';
✗ import { Bundler } from 'bun-bundler'; const Bundler = require('bun-bundler');
The primary Bundler class is a default export, reflecting its central role. This package is ESM-first and built for the Bun runtime.
ImageProcessor
✓ import { ImageProcessor } from 'bun-bundler/modules';
✗ import ImageProcessor from 'bun-bundler/modules'; import { ImageProcessor } from 'bun-bundler';
Utility classes like ImageProcessor, SpriteBuilder, and Server are named exports from the 'bun-bundler/modules' submodule.
Server
✓ import { Server } from 'bun-bundler/modules';
✗ import Server from 'bun-bundler/modules'; import { Server } from 'bun-bundler';
The development server functionality is provided via the named 'Server' export from the 'bun-bundler/modules' submodule.

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.

import Bundler from 'bun-bundler'; import { ImageProcessor, SpriteBuilder } from 'bun-bundler/modules'; const bundler = new Bundler(); const imgProcessor = new ImageProcessor(); const spriteBuilder = new SpriteBuilder(); bundler.build({ dist: './build', sass: './src/scss/app.scss', cssDist: './build/css/', js: './src/js/app.js', jsDist: './build/js/', html: './src/pug/', htmlDist: './build', staticFolders: ['./src/images/', './src/fonts/', './src/static/'], assembleStyles: './build/css/app.css', production: true, onBuildComplete: () => { imgProcessor.start({ entry: './build/images' }); spriteBuilder.start({ dist: './build/images/sprite/sprite.svg', entry: './build/', spriteIconSelector: 'svg[data-sprite-icon]', }); }, }).catch(error => { console.error('Build failed:', error); process.exit(1); });
bun-bundler --version
Debug
Known issues
breakingAs a pre-1.0 package (current version 0.2.12), the API of `bun-bundler` is subject to frequent changes. Breaking changes may occur in minor or even patch versions.
fix
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.
affects: >=0.1.0
gotchaThis bundler explicitly requires the Bun runtime. It will not work with Node.js or Deno due to its reliance on Bun's native APIs and build processes.
fix
Ensure Bun version 1.0.0 or greater is installed globally and that scripts are run using `bun run <script>`.
affects: >=0.1.0
gotchaCore `Bundler` class is a default export, while utility classes (`ImageProcessor`, `SpriteBuilder`, `Server`) are named exports from a separate submodule (`bun-bundler/modules`). Mixing these up leads to import errors.
fix
Use `import Bundler from 'bun-bundler';` for the main bundler, and `import { ImageProcessor, Server } from 'bun-bundler/modules';` for utilities.
affects: >=0.1.0
Errors
Common errors & fixes
Error: No Bun runtime found or version is incompatible. Bun >=1.0.0 required.
The Bun runtime is either not installed on your system or the installed version is older than 1.0.0, which is a minimum requirement.
fix
Install or upgrade Bun to version 1.0.0 or newer (e.g., `curl -fsSL https://bun.sh/install | bash` or `bun upgrade`).
SyntaxError: Named export 'Bundler' not found. Did you mean to import it as a default import?
You are attempting to import the `Bundler` class as a named export (`import { Bundler }`), but it is exported as a default export.
fix
Change your import statement to `import Bundler from 'bun-bundler';`.
Error: Cannot find module 'bun-bundler/modules' from '<your-project-path>'
This error typically occurs if you're trying to import utility modules directly from the main package path or if the 'modules' submodule path is incorrect.
fix
Ensure that utility classes like `ImageProcessor`, `SpriteBuilder`, or `Server` are imported with the correct path: `import { ImageProcessor } from 'bun-bundler/modules';`.
Upgrade
Version history
0.2.12latest on npm
Audit
Dependencies
bunrequiredRequired runtime environment (>=1.0.0) for all bundling and development server operations.
Agent activity
7 hits · last 30 days
node
4
Resources
bun-bundler — npm install bun-bundler · libregistry