const WebpackAliyunOss = require('webpack-aliyun-oss') const args = process.argv.slice(2) || [] const ifProd = args[0] === 'prod' new WebpackAliyunOss({ from: ['./dist/**'], dist: '/', overwrite: true, region: 'oss-cn-guangzhou', accessKeyId: ifProd ? 'LTAI5tK6dDnADdj1mgS6X9oa' : 'LTAINmC91NqIGN38', accessKeySecret: ifProd ? 'fxg0tBxHj9gCGikaDXUmWj8pC9IrVu' : 'Hh10dQPjq1jMLLSpbDAR05ZzR3nXsU', bucket: `dating-clue-opr${ifProd ? '-prod' : '-test'}`, setOssPath(filePath) { let index = filePath.lastIndexOf('dist') let Path = filePath.substring(index + 4, filePath.length) return Path.replace(/\\/g, '/') }, setHeaders() { return { //'Cache-Control': 'max-age=31536000' } }, }).apply()