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

webfunny-vite-plugin

v1.0.1

Published

Vite plugin for uploading source maps to Webfunny monitoring system

Downloads

26

Readme

webfunny-vite-plugin

Vite 插件,用于在构建完成后自动上传 SourceMap 到 Webfunny 监控系统。

安装

npm install webfunny-vite-plugin --save-dev

使用方法

基本用法

// vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { webfunnyVitePlugin } from 'webfunny-vite-plugin'

export default defineConfig({
  plugins: [
    vue(),
    webfunnyVitePlugin({
      url: 'http://your-server.com/api/sourceMapFile/upload',
      projectId: 'your-project-id',
      release: '1.0.0'
    })
  ],
  build: {
    sourcemap: true  // 必须开启 sourcemap
  }
})

完整配置

webfunnyVitePlugin({
  // 必填参数
  url: 'http://your-server.com/api/sourceMapFile/upload',  // file_server 上传地址
  projectId: 'your-project-id',                             // 项目 ID
  release: '1.0.0',                                         // 版本号
  
  // 可选参数
  projectName: 'My Project',      // 项目名称
  urlPrefix: 'https://cdn.example.com/assets/',  // CDN URL 前缀
  deleteAfterUpload: true,        // 上传后删除 .map 文件(默认 true)
  silent: false,                  // 静默模式,不输出日志(默认 false)
  include: /\.map$/,              // 包含的文件(正则或数组)
  exclude: /vendor/,              // 排除的文件(正则或数组)
})

配置项

| 参数 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | url | string | ✅ | - | file_server 上传 URL | | projectId | string | ✅ | - | 项目 ID | | release | string | ✅ | - | 版本号 | | projectName | string | ❌ | '' | 项目名称 | | urlPrefix | string | ❌ | '' | CDN URL 前缀 | | deleteAfterUpload | boolean | ❌ | true | 上传后删除 .map 文件 | | silent | boolean | ❌ | false | 静默模式 | | include | RegExp \| string[] | ❌ | /\.map$/ | 包含的文件 | | exclude | RegExp \| string[] | ❌ | null | 排除的文件 |

环境变量

推荐使用环境变量管理敏感配置:

// vite.config.js
import { defineConfig } from 'vite'
import { webfunnyVitePlugin } from 'webfunny-vite-plugin'

export default defineConfig({
  plugins: [
    webfunnyVitePlugin({
      url: process.env.WEBFUNNY_UPLOAD_URL,
      projectId: process.env.WEBFUNNY_PROJECT_ID,
      release: process.env.npm_package_version,  // 使用 package.json 版本号
    })
  ],
  build: {
    sourcemap: true
  }
})

与 webpack 版本对比

本插件的 API 设计与 webfunny-webpack-plugin 保持一致,便于项目迁移:

| 功能 | webfunny-webpack-plugin | webfunny-vite-plugin | |------|------------------------|---------------------| | 配置参数 | ✅ 相同 | ✅ 相同 | | 自动上传 | ✅ afterEmit hook | ✅ closeBundle hook | | 删除 .map 文件 | ✅ 支持 | ✅ 支持 | | 静默模式 | ✅ 支持 | ✅ 支持 | | 文件过滤 | ✅ include/exclude | ✅ include/exclude |

License

ISC