@oceanfe/upload-buffet-plugin
Generate & upload buffet config to cdn.
yarn add -D @oceanfe/upload-buffet-plugin
[toc]
Plugin config
Property | Type | Required | Example |
---|---|---|---|
appName | string | 🗸 | vcs |
sha | string | 🗸 | d2f38a3c6507b2520101f9a3807ed98f1bdc545a |
cdn.buffet | string | 🗸 | coding-assets-12341234 |
cdn.region | string | 🗸 | ap-shanghai |
cdn.secretId | string | 🗸 | xxxxxx |
cdn.secretKey | string | 🗸 | xxxxxxxxxx |
manifestFileName | string |
assets-manifest.json , doesn't emit file by default |
|
buffetFolder | string |
micro-frontend/buffet by default |
|
appPublicPath | string | https://assets.codehub.cn/micro-frontend/vcs |
Add following lines to webpack production config:
const { UploadBuffetPlugin } = require('@oceanfe/upload-buffet-plugin');
// ...
module.exports = {
// ...
plugins: [
// ...
new UploadBuffetPlugin({
cdn: {
secretId: process.env.SecretId,
secretKey: process.env.SecretKey,
bucket: process.env.Bucket,
region: process.env.Region,
},
sha: process.env.GIT_COMMIT,
appName: `YOUR_APP_NAME`, // `vcs`, `ci` for example
})
]
}
Buffet file
files are under https://assets.codehub.cn/micro-frontend/buffet/ by default.
File sample:
{
"name": "vcs",
"css": [
"https://assets.codehub.cn/micro-frontend/vcs/static/css/main.8c8b27cf.chunk.css"
],
"js": [
"https://assets.codehub.cn/micro-frontend/vcs/static/js/runtime-main.9001dbdf.js",
"https://assets.codehub.cn/micro-frontend/vcs/static/js/2.d0eb047a.chunk.js",
"https://assets.codehub.cn/micro-frontend/vcs/static/js/main.a31a76ce.chunk.js"
],
"commitId": "1532afa59a781a61becf2b59598375b9f8c871b0"
}