npm run build 自动生成dist.zip

devtools/2024/10/19 0:22:17/

需求场景:每次项目打包都需要手动将dist文件夹,压缩为dist.zip 比较繁琐
功能实现:每次运行npm run build 自动生成 dist.zip

首先下载插件

npm install filemanager-webpack-plugin --save-dev

然后在项目根目录找到:vue.config.js 文件

const { defineConfig } = require('@vue/cli-service')
// 插件地址: https://www.npmjs.com/package/filemanager-webpack-plugin
const FileManagerPlugin = require('filemanager-webpack-plugin')
const path = require('path')module.exports = defineConfig({lintOnSave: false,transpileDependencies: true,// 配置插件configureWebpack: {plugins: [new FileManagerPlugin({events: {onEnd: {delete: ['./dist.zip'],archive: [{source: path.join(__dirname, './dist'),destination: path.join(__dirname, './dist.zip')}]}}})]}
})

最后在终端运行:npm run build ,运行结束在项目根目录自动生成 dist.zip 压缩包


http://www.ppmy.cn/devtools/4660.html

相关文章

.Net ajax 接收参数

后端部分代码 一般处理程序 public void ProcessRequest(HttpContext context){context.Response.ContentType "text/plain";string str_index context.Request.Form.AllKeys.Contains("index") ? context.Request.Form["index"].ToString(…

【Kafka】Kafka 架构深入

Kafka 工作流程及文件存储机制 Kafka 中消息是以 topic 进行分类的,生产者生产消息,消费者消费消息,都是面向 topic 的。 topic 是逻辑上的概念,而 partition 是物理上的概念,每个 partition 对应于一个 log 文件&am…

Proxyman Premium for Mac v5.1.1激活版:卓越的网络调试与分析工具

Proxyman Premium for Mac是一款功能强大的网络调试与分析工具,专为开发人员和测试人员精心打造。它集多种功能于一身,为用户提供了全面、高效的网络开发体验。 Proxyman Premium for Mac v5.1.1激活版下载 作为一款跨平台代理工具,Proxyman …

openssl 如何从pfx格式证书 获取证书序列号信息

已知:一个个人证书文件 test.pfx 求:如何通过openssl查看其对应证书的序列号信息? 踩坑之:unable to load certificate! openssl x509 -in xxx.cert -noout -serial 命令可查看证书序列号,但是这个-in 的输入必须是私…

Pytorch实用教程:pytorch使用模型时并没有调用forward函数,那么前向运算是如何执行的呢?

在 PyTorch 中,尽管我们定义了 forward 方法来指定模型的前向传播逻辑,实际上我们通常不直接调用这个方法。相反,我们通过调用模型对象本身来触发前向传播,这背后的机制涉及到了 Python 的 __call__ 方法。 __call__ 方法的作用 …

c++补充

构造函数、析构函数 #include <iostream> using namespace std;// 构造函数、析构函数 // --- "构造函数"类比生活中的"出厂设置" --- // --- "析构函数"类比生活中的"销毁设置" --- // 如果我们不写这两种函数&#xff0c;编译…

docker下安装redis

1.下载redis镜像 docker pull redis 2.找到具体的版本号 docker images docker image inspect 7614ae9453d1 3.根据对应的版本号&#xff0c;下载conf 配置文件 https://download.redis.io/releases/ 看下面2个配置是不是ok&#xff1a; bind 127.0.0.1 -::1 logfile &qu…

Java NIO中的mmap

Java中的mmap使用&#xff1a; static private final int start 0; static private final int size 1024; static public void main(String args[]) throws Exception {RandomAccessFile raf new RandomAccessFile("D:\\IO\\mmap-test.txt", "rw");File…