Vue 将打包后的静态文件上传至阿里云oss
1、配置config目录下的index.js注意 assetsSubDirectory 不要和原来的冲突build: {.....assetsSubDirectory: 'test-static',oss_publicPath: 'your publicPath',oss_accessKeyId: 'your key',oss_accessKe...
·
1、配置config目录下的index.js
注意 assetsSubDirectory 不要和原来的冲突
build: {
.....
assetsSubDirectory: 'test-static',
oss_publicPath: 'your publicPath',
oss_accessKeyId: 'your key',
oss_accessKeySecret: 'your secret',
oss_region: 'your region',
oss_bucket: 'your bucket'
.....
}
2、配置build目录下的webpack.prod.conf.js
const AliyunOSSPlugin = require("aliyun-oss-webpack-plugin")
....
// 配置 output 的 publicPath
output: {
publicPath: config.build.oss_publicPath,
...
},
// 配置 plugins
plugins: [
new AliyunOSSPlugin({
accessKeyId: config.build.oss_accessKeyId,
accessKeySecret: config.build.oss_accessKeySecret,
region: config.build.oss_region,
bucket: config.build.oss_bucket
}),
....
]
....
运行 npm run build
进行测试
正常不报错 表示成功
更多推荐
已为社区贡献27条内容
所有评论(0)