Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Slipshade's avatar

Vitejs. Running a script for a specific task

I'm using Vite. I installed the npm plugin called 'vite-plugin-zip-file' in order to archive the dist folder. How can I run a separate from 'build' script in package.json specifically for this task?

vite.config.js:

import { defineConfig } from 'vite';
import { resolve } from 'path';
import { viteZip } from 'vite-plugin-zip-file';

export default defineConfig({
build: {
    outDir: 'build',
},
plugins: [
    viteZip({
      folderPath: resolve(__dirname, 'build'),
      outPath: resolve(__dirname),
      zipName: 'Test.zip',
    }),
],
});

package.json 'scripts' (I don't know what to write in 'zip' here):

 "scripts": {
    "dev": "vite",
    "build": "vite build",
    "serve": "vite preview"
    "zip": ?
  },

I tried adding the environmental variable, but I don't know exactly how to do it. So, there's probably another better way.

0 likes
0 replies

Please or to participate in this conversation.