vue项目自动化部署到阿里云OSS或者服务器

部署到oss    aliyunoss-webpack-plugin 

   1.npm

 npm install aliyunoss-webpack-plugin --save-dev

    2.  具体参数看文档   

cli2   webpack.prod.conf.js
const AliyunossWebpackPlugin = require('aliyunoss-webpack-plugin')

plugins: [
    ...
    new AliyunossWebpackPlugin({
      buildPath: 'dist/**',
      region: your.region,
      accessKeyId: your.accessKeyId,
      accessKeySecret: your.accessKeySecret,
      bucket: your.bucket,
      generateObjectPath: function(filename, file) {
        //配置上传地址
        return file.replace(/dist\//, '')
      },
    })
}


cli3 vue.config.js

          config
            .plugin('aliyunoss-webpack-plugin')
            .use(require('aliyunoss-webpack-plugin'), [{
              buildPath: 'dist/**',
              region: process.env.VUE_APP_region,
              accessKeyId: process.env.VUE_APP_accessKeyId,
              accessKeySecret: process.env.VUE_APP_accessKeySecret,
              bucket: process.env.VUE_APP_bucket,
              generateObjectPath: (filename, file) => {
                return process.env.VUE_APP_filepath + file.replace(/dist\//, '')
              }
            }])

部署到服务器   fjpublish 详情看文档吧

你可能感兴趣的:(vue项目自动化部署到阿里云OSS或者服务器)