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-plugin-vue2

v0.1.18

Published

A Vue 2.7 Single File Component (SFC) plugin for Bun, ported from @vitejs/plugin-vue2.

Readme

bun-plugin-vue2

English | 简体中文

一个移植自@vitejs/plugin-vue2用于 Bun 的 Vue 2.7 单文件组件(SFC)插件。

简介

bun-plugin-vue2 允许你在 Bun 环境中直接使用 Vue 2.7 单文件组件(.vue 文件),无需额外的构建工具。该插件支持 Vue 2.7 的所有特性,包括 <script setup> 语法糖。

特性

  • ✅ 支持 Vue 2.7 单文件组件
  • ✅ 支持 <script setup> 语法
  • ✅ 支持 Scoped CSS 和 CSS Modules
  • ✅ 支持模板中的静态资源引用
  • ✅ 支持自定义块
  • ✅ 支持 HMR(热模块替换)
  • ✅ 支持异步组件
  • ✅ 支持 src 属性导入外部文件

安装

bun install bun-plugin-vue2 -D

使用

基本用法

在你的 Bun 构建脚本中使用该插件:

import vue from 'bun-plugin-vue2'

await Bun.build({
  entrypoints: ['./main.js'],
  outdir: './dist',
  plugins: [vue()]
})

配置选项

vue({
  // 包含的文件模式,默认为 /\.vue$/
  include: /\.vue$/,

  // 排除的文件模式
  exclude: undefined,

  // 是否为生产环境
  isProduction: process.env.NODE_ENV === 'production',

  // Vue 编译器选项
  template: {
    compilerOptions: {},
    transformAssetUrls: {}
  },

  // 脚本选项
  script: {
    babelParserPlugins: []
  },

  // 样式选项
  style: {
    trim: true
  }
})

开发

# 安装依赖
bun install

# 开发模式(热重载)
bun dev

# 构建 playground
bun run build:playground

# 运行测试
bun test

Playground Example

项目包含一个移植自@vitejs/plugin-vue2完整的示例应用(playground目录),展示了插件的各种功能:

  • CSS 相关:Scoped CSS、CSS Modules、CSS v-bind
  • 组件:递归组件、异步组件
  • <script setup> 语法
  • 静态资源引用
  • 自定义块
  • HMR 热更新

技术栈

  • 运行时: Bun
  • 语言: TypeScript
  • 框架: Vue 2.7
  • 模块规范: ES2020

贡献

欢迎贡献代码!如果你发现了 bug 或有新功能建议,请:

  1. Fork 本仓库
  2. 创建你的特性分支 (git checkout -b feature/amazing-feature)
  3. 提交你的改动 (git commit -m 'Add some amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 提交 Pull Request

开发指南

  • 确保代码符合 TypeScript 规范
  • 保留调试日志,便于问题排查
  • 为新功能添加相应的测试用例
  • 在 playground 中验证功能正常工作

联系方式

如有问题或建议,欢迎通过以下方式联系:

许可证

MIT

注意事项

因为未知原因,虽然本插件实现了构建模式正常工作,但是目前无法在Bun v1.3提供的新特性Fullstack dev serverHot reloading中使用