- Home
- Skills
- Daleseo
- Bun Skills
- Bun Build
bun-build_skill
3
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill daleseo/bun-skills --skill bun-build- SKILL.md8.3 KB
Overview
This skill creates optimized production bundles using Bun's native bundler. It replaces heavier toolchains like webpack, esbuild, or rollup and focuses on fast builds, code splitting, and content-hashed outputs. It includes templates for browser, Node.js, Bun runtime, libraries, and CLI tools, plus environment-aware build scripts.
How this skill works
The skill generates Bun.build scripts that accept entrypoints, target platform, output format, and optimization flags. It supports minification, code splitting, source maps, custom loaders, and content-hash naming for cache busting. Environment-specific configuration and type-declaration generation for libraries are included, along with verification and troubleshooting patterns.
When to use it
- Building a frontend app that needs fast production bundles and cache-friendly filenames
- Packaging a Node.js or Bun backend while excluding node_modules from the bundle
- Publishing a library or CLI with both ESM and CJS outputs plus type declarations
- Replacing webpack/esbuild/rollup to simplify the toolchain and speed up CI builds
- Setting up multi-environment builds (development vs production) with different optimizations
Best practices
- Use target and format that match your runtime (browser -> esm, node -> esm/cjs as needed)
- Enable splitting and content-hash naming for long-term caching of static assets
- Define process.env variables at build time to enable dead code elimination
- Keep node_modules external for server builds to avoid large bundles
- Run type-checking and tests before the production build in CI
Example use cases
- Frontend SPA: build with target: 'browser', splitting: true, and hashed filenames for CDN deployment
- Node service: build server entry with target: 'node' and external: ['*'] to preserve native modules
- Library release: produce both ESM and CJS bundles, emit .d.ts files, and populate package.json exports
- CLI tool: bundle a single executable entry with minimal runtime overhead
- Environment scripts: run NODE_ENV=production bun run build-env.ts for production-ready assets
FAQ
Set external: ['*'] or list specific packages in external to exclude them from bundling.
How should I generate type declarations for a library?
Build JS with Bun.build then run tsc with --declaration --emitDeclarationOnly --outDir dist to emit .d.ts files.