bosupload-loader
v1.0.2
Published
upload resources to bos(Baidu Object Storage) for webpack
Downloads
7
Readme
bosupload-loader
upload resources to bos(Baidu Object Storage) for webpack
Install
npm install --save-dev bosupload-loader
Usage
import img from './imgs/xx.png'
module.exports = {
module: {
rules: [
{
test: /\.(png|jpe?g|gif|webp)$/,
use: [
{
loader: 'bosupload-loader',
options: {
accountConfig: {
credentials: {
ak: 'your bos ak, required',
sk: 'your bos sk, required'
},
endpoint: 'your bos endpoint, required',
urlPrefix: 'your urlPrefix, required',
bucket: 'your bos bucket name'
}
}
},
{
loader: 'url-loader',
options: {
// 超过1024byte的资源以外链形式存入bos
limit: 1024
}
}
]
}
]
}
}
Options
|Name| Type | Default | Description | |---|---|---|---| | accountConfig | {Object}|null | bos account config | | limit | {number}| no limit | Byte limit to save in bos, if exceed, default use file-loader | |headers| {Object}|null | e.g. Cache-Control: max-age=2592000|