webpack 手动配置打包.zip 文件插件

1.filemanager-webpack-plugin 可以将打包好的代码进行 压缩 移动 删除操作

参考filemanager-webpack-plugin的配置:github: https://github.com/gregnb/filemanager-webpack-plugin

安装:(有版本限制)
例如 2.x的webpack使用2.05版本

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

webpack.prod.config

const FileManagerPlugin = require('filemanager-webpack-plugin');

module.exports = {
     
  ...
  ...
  plugins: [
   new FileManagerPlugin({
     
      onEnd: {
     
        delete: ["./dist.zip"],
        archive: [{
      source: "./dist", destination: "./dist.zip" }],
      },
    }),
  ],
  ...
}

这样就ok了(参考)

zip-webpack-plugin的配置文件:https://github.com/erikdesjardins/zip-webpack-plugin

进行配置

const ZipWebpackPlugin = require('zip-webpack-plugin')
new ZipWebpackPlugin ({
     
  path:path.join(__dirname,'../dist'),
  filename: 'bhg-member-portal.zip'
})

转载:https://blog.csdn.net/weixin_42259266/article/details/94721720

你可能感兴趣的:(webpack)