3.0.2 • Published 6 years ago

aliyun-oss-webpack-plugin v3.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

put all bundles except HTML to your aliyun oss.

Installation

webpack 4.x:

npm install aliyun-oss-webpack-plugin --save

webpack 2.x || 3.x:

npm install aliyun-oss-webpack-plugin@"^2.0.1" --save

Configuration

const AliyunOSSPlugin = require("aliyun-oss-webpack-plugin");
module.exports = {
    output: {
        publicPath: "https://domain.com/p/a/t/h" // !required
    },
    plugins: [
        new AliyunOSSPlugin({
            accessKeyId: '*****',
            accessKeySecret: '*****',
            region: 'oss-cn-hangzhou',
            bucket: '*****',
            headers: {
              'Cache-Control': 'max-age=3600'
            }
        })
    ]
}

Example

webpack.config.js:

const path = require('path');
const AliyunOSSPlugin = require("aliyun-oss-webpack-plugin");

module.exports = {
    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, './public'),
        filename: 'index.js',
        publicPath: 'https://my.static.assets.domain/my-project/1.0.0/',
    },
    plugins: [
        new AliyunOSSPlugin({
            accessKeyId: '*****',
            accessKeySecret: '*****',
            region: 'oss-cn-hangzhou',
            bucket: '*****',
            headers: {
              'Cache-Control': 'max-age=3600',
            },
        })
    ]
}

index.html:

<script src="https://my.static.assets.domain/my-project/1.0.0/index.js"></script>
3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.1

6 years ago

1.0.0

7 years ago