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

vite-plugin-extra-dist

v1.1.0

Published

A Vite plugin that copies build output to an additional specified directory

Readme

vite-plugin-extra-dist

一个 Vite 插件,用于在构建时将输出内容额外复制到指定目录。

功能特性

  • 🚀 在 Vite 构建完成后自动复制输出文件到指定目录
  • 🧹 支持在复制前清空目标目录
  • 📁 支持文件/目录的包含和排除规则
  • 📝 详细的日志输出
  • 💪 完整的 TypeScript 支持

安装

# 使用 npm
npm install vite-plugin-extra-dist --save-dev

# 使用 yarn
yarn add vite-plugin-extra-dist --dev

# 使用 pnpm
pnpm add vite-plugin-extra-dist --save-dev

使用方法

在你的 vite.config.ts 中配置插件:

import { defineConfig } from 'vite'
import { extraDist } from 'vite-plugin-extra-dist'

export default defineConfig({
  plugins: [
    extraDist({
      targetDir: '\\\\192.168.5.49\\font\\DP\\nginx-1.19.3\\wms_dist'
    })
  ]
})

配置选项

interface ExtraDistOptions {
  /**
   * 额外输出目录的路径
   */
  targetDir: string;
  
  /**
   * 是否在复制前清空目标目录
   * @default true
   */
  cleanTarget?: boolean;
  
  /**
   * 是否显示详细日志
   * @default true
   */
  verbose?: boolean;
  
  /**
   * 要排除的文件或目录模式
   */
  exclude?: string[];
  
  /**
   * 只包含特定的文件或目录模式
   */
  include?: string[];
}

使用示例

基本使用

import { defineConfig } from 'vite'
import { extraDist } from 'vite-plugin-extra-dist'

export default defineConfig({
  plugins: [
    extraDist({
      targetDir: '/path/to/deploy/directory'
    })
  ]
})

高级配置

import { defineConfig } from 'vite'
import { extraDist } from 'vite-plugin-extra-dist'

export default defineConfig({
  plugins: [
    extraDist({
      targetDir: '/path/to/deploy/directory',
      cleanTarget: true,
      verbose: true,
      exclude: ['*.map', '*.txt'],
      include: ['*.js', '*.css', '*.html']
    })
  ]
})

网络共享目录部署

import { defineConfig } from 'vite'
import { extraDist } from 'vite-plugin-extra-dist'

export default defineConfig({
  plugins: [
    extraDist({
      targetDir: '\\\\192.168.1.100\\shared\\web\\dist',
      cleanTarget: true,
      verbose: true
    })
  ]
})

工作原理

  1. 插件在 Vite 构建完成后(closeBundle 钩子)执行
  2. 如果 cleanTargettrue,先清空目标目录
  3. 递归复制构建输出目录(默认为 dist)到指定的目标目录
  4. 支持文件过滤规则(include/exclude)
  5. 提供详细的日志输出

许可证

MIT

贡献

欢迎提交 Issue 和 Pull Request!