npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bun-as-vite

v1.1.0

Published

Run Vite-configured React and web apps on Bun natively with zero config rewrite. Full drop-in replacement for Vite defineConfig with Bun.build and Bun.serve.

Readme

bun-as-vite ⚡

Run Vite-configured web applications on Bun natively with zero config rewrite.

bun-as-vite is a drop-in replacement for Vite's defineConfig. It lets you keep your standard Vite project structure, plugin definitions, and configuration format, while driving Bun.build and Bun.serve under the hood for 10x faster builds and instant dev startup.


Features

  • ⚡ Zero-Rewrite defineConfig: Use standard Vite configuration options (root, server.proxy, resolve.alias, build, define, plugins).
  • 🔄 Native Bun Dev Server with HMR: Built-in WebSocket Hot Module Replacement with automatic fallback.
  • 🚀 Full Bun.build Integration: Supports synthetic code-splitting, custom chunk naming, and direct passthrough of any extra Bun.build options from defineConfig.
  • 🌐 Vite-Standard Proxy: Supports string shorthand, options objects with rewrite(), changeOrigin, and RegExp path matching.
  • ⚛️ Universal React Support: Out-of-the-box support for React 17, 18, and 19, including native and fallback React Compiler runtimes (react/compiler-runtime & react-compiler-runtime).
  • 🎨 Tailwind CSS v4 & JIT: Automatic CSS URL rewriting and composable CSS transformation pipeline.
  • 📦 First-Class Plugin System: Hook-driven plugin lifecycle (configBun, cssTransform, buildComplete, serverRequest).

Installation

bun add -d bun-as-vite
# or
npm install -D bun-as-vite

Quick Start

1. Create bun.config.js (or bun.config.ts)

import { defineConfig } from 'bun-as-vite';
import {
  tailwindcss,
  codeSplitPlugin,
  proxyRedirectsPlugin,
  customConfigPlugin,
  envLoaderPlugin,
  buildScorerPlugin,
} from 'bun-as-vite/plugins';

const config = defineConfig(() => ({
  plugins: [
    tailwindcss(),
    customConfigPlugin({ alias: { '@': 'src/@' } }),
    codeSplitPlugin({
      groups: [
        { name: 'vendor-charts', test: /[\/\\]node_modules[\/\\](chart\.js|recharts)[\/\\]/ },
        { name: 'vendor-ui', test: /[\/\\]node_modules[\/\\](@carbon|carbon-components)[\/\\]/ },
      ],
    }),
    proxyRedirectsPlugin(),
    envLoaderPlugin(),
    buildScorerPlugin(),
  ],
  server: {
    port: 4545,
    proxy: {
      '/api': {
        target: 'https://api.example.com',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    },
  },
  define: {
    global: 'globalThis',
  },
}));

export default config;

// Optional: Run directly with `bun bun.config.js --dev`
await config.run();

2. Add Scripts to package.json

{
  "scripts": {
    "dev:bun": "bun bun.config.js --dev",
    "build:bun": "bun bun.config.js --build",
    "serve:bun": "bun bun.config.js --preview"
  }
}

Or run via the CLI binary:

bun-as-vite dev
bun-as-vite build
bun-as-vite preview

Extra Bun.build Options

Any extra properties not recognized as Vite core options are automatically forwarded and spread directly to Bun.build:

export default defineConfig(() => ({
  // Top-level Bun.build options:
  packages: 'bundle',
  format: 'esm',
  external: ['some-external-package'],

  // Or inside build:
  build: {
    outDir: 'dist',
    drop: ['console', 'debugger'],
  },

  // Or explicitly in a bun / bunBuild block:
  bunBuild: {
    banner: '/* Generated by bun-as-vite */',
  },
}));

Universal React Compiler Support

bun-as-vite automatically detects and bridges React Compiler runtimes across versions:

  • React 19: Resolves react/compiler-runtime to React 19's native runtime.
  • React 17 & 18: Resolves react/compiler-runtime to the react-compiler-runtime package.
  • Zero-Dependency Fallback: Injects an in-memory virtual shim if neither package is present so your build never breaks.

Included Plugins

| Plugin | Description | |---|---| | codeSplitPlugin({ groups }) | Synthetic code-splitting for Bun.build with custom vendor chunks. | | proxyRedirectsPlugin({ proxy, templateFile }) | Netlify-style redirects or standard Vite proxy configurations. | | customConfigPlugin({ alias }) | Path aliases and directory mapping. | | envLoaderPlugin({ prefixes }) | Extra environment variable prefixes for import.meta.env. | | buildScorerPlugin() | Terminal bundle size audit and oversized chunk warning report. | | tailwindcss() | Tailwind CSS v4 JIT compilation hook. | | wrapPlugin(plugin) | Wraps third-party Vite plugins for safe execution under Bun. |


License

MIT © Yathin