# zip-webpack-plugin - 压缩 dist
# 1. 使用
const path = require('path');
const ZipWebpackPlugin = require('zip-webpack-plugin');
module.exports = {
plugins: [
new ZipWebpackPlugin({
// proj/dist-zip
path: path.resolve(__dirname, 'dist-zip'),
// OPTIONAL: defaults to the empty string
// the prefix for the files included in the zip file
pathPrefix: 'dist', // 'relative/path'
// dist-zip/dist_2023-08-20_09h08m55s.zip
filename: (function getFilename() {
const date = moment().format('YYYY-MM-DD_HH[h]mm[m]ss[s]');
return `dist_${date}`;
}()),
}),
]
}
# 2. 参考
上一篇: 下一篇:
本章目录