filemanager-webpack-plugin 打包自动压缩zip

yarn  build:prod后生成的dist资源文件夹,自动打包成dist.zip压缩包

使用filemanager-webpack-plugin打包静态资源

yarn add filemanager-webpack-plugin -D
 
npm i filemanager-webpack-plugin -D
 
cnpm i filemanager-webpack-plugin -D

配置报错信息:

ValidationError: Invalid actions object. FileManagerPlugin has been initialized using an actions object that does not match the API schema.

  • actions has an unknown property ‘onEnd’. These properties are valid:
    object { events?, runTasksInSeries?, context? }
    ValidationError: Invalid actions object. FileManagerPlugin has been initialized using an actions object that does not match the API schema.
  • actions has an unknown property ‘onEnd’. These properties are valid:

解决方案:

配置使用

vue.config.js

const FileManagerPlugin = require('filemanager-webpack-plugin');
module.exports = {
   configureWebpack: config =>  {
    config.plugins.push(
      new FileManagerPlugin(
        {
          events: {
            onEnd: {
              delete: ['./dist.zip'],
              archive: [{
                source: path.join(__dirname, './dist'),
                destination: path.join(__dirname, './dist.zip')
              }]
            }
          }
        }
      )
    )
  },
}

特别注意:

filemanager-webpack-plugin 打包自动压缩zip_第1张图片

 

你可能感兴趣的:(前端,node.js,vue.js)