Code Monkey home page Code Monkey logo

vite-plugin-dist-zip's Introduction

安装

npm install vite-plugin-dist-zip -D

说明

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

配置

// vite.config.ts

import vitePluginZipDist from "vite-plugin-dist-zip";
import {name} from "./package.json";

export default defineConfig({
    plugins: [
        vitePluginZipDist({zipName: name}),
    ]
});

选项说明

字段 类型 默认值 说明
zipName 字符串 dist 生成的压缩包名称
zipDir 字符串 压缩文件存放路径;相对于vite项目根目录;为空时值为 viteConfig.build.outDir;不会创建目录,请确保目录已存在
dayjsFormat 字符串 YYMMDD_HHmm dayjs 日期格式 YYMMDD_HHmm,会拼在压缩包名称上,便于区分压缩包
includeDistDir 布尔 false 为true时 压缩包会包含dist 目录本身, false 只压缩dist 内容

vite-plugin-dist-zip's People

Contributors

pangyunchuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

xianziljl

vite-plugin-dist-zip's Issues

生成压缩包的目录配置问题

目前生成的压缩包是dist文件夹的内容,不包含dist文件夹,zipDir只能配置压缩包产生的位置,能否配置可以对dist整个文件夹生成压缩包

Cannot use import statement outside a module

error during build:                                                                                                                        15:45:58
/MyProjectDir/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vite-plugin-dist-zip/dist/dist.es.js:1
import S from "jszip";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1032:15)
    at Module._compile (node:internal/modules/cjs/loader:1067:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:168:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.