aliyun-oss-webpack-plugin

3.0.2 • Public • Published

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>

Package Sidebar

Install

npm i aliyun-oss-webpack-plugin

Weekly Downloads

5

Version

3.0.2

License

MIT

Unpacked Size

4.71 kB

Total Files

3

Last publish

Collaborators

  • xuyuanxiang