umijs2.x filemanager-webpack-plugin 将dist压缩为dist.zip包

umijs2.x filemanager-webpack-plugin 将dist压缩为dist.zip包,第1张

const path = require('path');
const routes = require('./src/routes/index');
const FileManagerWebpackPlugin = require('filemanager-webpack-plugin');
const isDev = process.env.NODE_ENV === 'development';

export default {
    base: '/admin/',
    treeShaking: true,
    publicPath: './',
    routes,
    hash: true,
    chainWebpack(config, { webpack }) {

        if (!isDev) {
            // 将dist压缩为dist.zip 压缩包
            config.plugin('filemanager-webpack-plugin').use(FileManagerWebpackPlugin, [
                {
                    events: {
                        onEnd: {
                            delete: ['./dist.zip'],
                            archive: [
                                {
                                    source: './dist',
                                    destination: './dist.zip'
                                }
                            ]
                        }
                    }
                }
            ]);
        }
    }
};

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1298019.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存