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 = ;moduleexports = output: publicPath: "https://domain.com/p/a/t/h" // !required plugins: accessKeyId: '*****' accessKeySecret: '*****' region: 'oss-cn-hangzhou' bucket: '*****' headers: 'Cache-Control': 'max-age=3600'
Example
webpack.config.js
:
const path = ;const AliyunOSSPlugin = ; moduleexports = entry: './src/index.js' output: path: path filename: 'index.js' publicPath: 'https://my.static.assets.domain/my-project/1.0.0/' plugins: 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>