Package Exports
- vite-plugin-zip-file
- vite-plugin-zip-file/lib/index.cjs
- vite-plugin-zip-file/lib/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vite-plugin-zip-file) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vite-plugin-zip-file
Zip files at build time.
Install
yarn add vite-plugin-zip-file --devor
npm install vite-plugin-zip-file --save-devOptions
| Param | Types | Rquired | Default | Desc | 
|---|---|---|---|---|
| folderPath | String|Path | true | /dist | Path to the compressed folder | 
| outPath | String|Path | true | / | Compressed package output path | 
| zipName | String | false | dist | Package name | 
| enabled | Boolean | false | true | This parameter is used to control whether the plugin is enabled. It is usually used to determine whether to compress files according to the environment | 
Usage
import { defineConfig } from 'vite';
import { viteZip } from 'vite-plugin-zip-file';
import path from 'path';
import { fileURLToPath } from 'url';
import { env } from 'node:process';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    viteZip({
      folderPath: path.resolve(__dirname, 'dist'),
      outPath: path.resolve(__dirname),
      zipName: 'Test.zip',
      enabled: env.NODE_ENV === 'production'? true: false
    })
  ]
})