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-dist-zip

v1.0.1

Published

用于在构建后将文件打入压缩包

Readme

安装

npm install vite-plugin-dist-zip -D

说明

在vite 构建后,将文件打包为压缩包,支持zip tar
只在构建时中使用
使用了 configResolved 钩子

配置

// vite.config.ts

import distZip from "vite-plugin-dist-zip";

export default defineConfig({
    plugins: [
    distZip()
    ]
});

2025-09-18 1.0.0版本 更新说嘛

使用 archiver 库,以支持 多种压缩格式,zip  tar

配置参数

| 字段 | 类型 | 默认值 | 说明 | |---------------------|--------------------|-------------------------------------|---------------------------------------------------------------------| | outDir | string | ResolvedConfig.build.outDir | 输出目录,默认与 Vite 的输出目录(build.outDir)相同,有需要可以自定义 | | fileName | string | ResolvedConfig.build.outDir | 压缩文件名称,默认与 Vite 的输出目录(build.outDir)相同,有需要可以自定义 | | fileNameDateseparator | string | '' | 压缩文件名称日期连接符,默认使用 '' 分隔 | | formatTemplate | string | false | 'YYYY-MM-DD-HH-mm-ss' | 压缩文件名日期部分格式,使用 dayjs 格式化,为 false 时不拼接日期到文件名 | | sourceDir | string | ResolvedConfig.build.outDir | 源文件目录,默认与 Vite 的输出目录(build.outDir)相同,有需要可以自定义,但通常不需要 | | includeSourceDir | boolean | string | false | 是否将源文件目录也加入压缩包,或指定压缩包中的目录名称。当设置为 true 时,使用压缩包文件名作为目录名;当设置为 'sourceDir' 时,使用源文件目录名;当设置为其他字符串时,使用该字符串作为目录名 | | archiveType | archiver.Format | 'zip' | 压缩类型,支持 zip 和 tar | | archiveZipOptions | archiver.ZipOptions | { zlib: { level: 9 } } | zip 选项,查看:https://www.archiverjs.com/docs/archiver#zip-options | | archiveTarOptions | archiver.TarOptions | { gzip: true, gzipOptions: { level: 9 } } | tar 选项,查看:https://www.archiverjs.com/docs/archiver#tar-options | | open | boolean | false | 完成时是否打开存档文件所在目录 | | cleanOutDir | boolean | true | 当输出目录不等于 Vite 的输出目录时,是否清空输出目录。注意:这会删除输出目录中的所有文件,请谨慎使用 |

旧版选项说明

| 字段 | 类型 | 默认值 | 说明 | |------------------| ---- | ---- |---------------------------------------------------------------------| | zipName | 字符串 | viteConfig.build.outDir | 压缩名称,不传默认为 viteConfig.build.outDir | | saveDir | 字符串 | viteConfig.build.outDir | 压缩文件存放路径;相对于vite项目根目录;为空时值为 viteConfig.build.outDir;不会创建目录,请确保目录已存在 | | zipDir 已弃用 | 字符串 | viteConfig.build.outDir | 已弃用,请改为 saveDir | | dayjsFormat | 字符串 | 默认值 "YYMMDD_HHmm" ; dayjs 日期格式。会拼在压缩包名称上,便于区分压缩包。可为空不设置将不设置 | | includeSourceDir | 布尔 | false | 是否将源文件目录打入压缩包。 默认值 false ; | | includeDistDir 已弃用 | 布尔 | false | 已弃用,改为 includeSourceDir |