tencent-cos-webpack-plugin
v0.0.4
Published
tencent cos webpack plugin
Downloads
2
Readme
Tecent COS Webpack Plugin
Upload the webpack build assets to Tencent COS, make it convinent to use CDN.
Quick Start
// import TencentCosWebpackPlugin
const TencentCosWebpackPlugin = require('tenent-cos-webpack-plugin');
// Instantiate the Plugin with your COS auth info
const cosPlugin = new CosPlugin({
secretId: 'my-secret-id', // usual use BucketName-APPID. refer: https://cloud.tencent.com/document/product/436/36119#.E7.AE.80.E5.8D.95.E4.B8.8A.E4.BC.A0.E5.AF.B9.E8.B1.A1
secretKey: 'my-secret-key',
bucket: 'my-125000000',
region: 'ap-chengdu',
path: 'xxx/' // the sub directory in the COS bucket, its default value is "[hash]/" which indicate the webpack build hash
changeFileName: Function, // change the filename under COS path。
proxy: 'xxx.proxy.com' // your http/https proxy
exclude: /\.map$/ // which file to exclude
});
// Webpack config
module.exports = {
output: {
// your cos domain
publicPath: "http://www.abc.com"
// ...
},
plugins: [
cosPlugin
// ...
]
// ...
}
Contribute
fork the repo
clone your repo
git clone https://github.com/xxxx/tencent-cos-webpack-plugin # clone the repo
- install dep
npm install # install dep
coding
lint & test
write unit test and execute it
npm run lint
npm run test
- put a pull request
Thanks
thanks to the repostory cos-webpack. I just change the output filename logic.