Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including tencent-cos-webpack-plugin with all npm packages installed. Try it out:

var tencentCosWebpackPlugin = require("tencent-cos-webpack-plugin")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tencent-cos-webpack-plugin v0.0.4

tencent cos webpack plugin

npm version downloads Build Status License

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:
  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: '' // your http/https proxy
  exclude: /\.map$/ // which file to exclude

// Webpack config
module.exports = {
 output: {
    // your cos domain
    publicPath: ""
    // ...
 plugins: [
   // ...
 // ...


  • fork the repo

  • clone your repo

git clone # 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 to the repostory cos-webpack. I just change the output filename logic.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free