https://github.com/cduyzh/webpack-plugin-qiniu-upload
A plugin upload file to qiniu clound for vue-cli4|vue-cli5|webpack5
https://github.com/cduyzh/webpack-plugin-qiniu-upload
aws qiniu upload-file vue vue-cli-plugin webpack-plugin webpack5
Last synced: 5 months ago
JSON representation
A plugin upload file to qiniu clound for vue-cli4|vue-cli5|webpack5
- Host: GitHub
- URL: https://github.com/cduyzh/webpack-plugin-qiniu-upload
- Owner: cduyzh
- License: mit
- Created: 2021-03-13T10:32:21.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T07:54:16.000Z (over 2 years ago)
- Last Synced: 2025-09-19T21:36:21.333Z (9 months ago)
- Topics: aws, qiniu, upload-file, vue, vue-cli-plugin, webpack-plugin, webpack5
- Language: JavaScript
- Homepage:
- Size: 107 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-vue - webpack-plugin-qiniu-upload - Vue3,webpack-plugin-qiniu-upload for qiniu(七牛)|aws(亚马逊) cloud upload. support @vue/cli-service 5.0.x (Components & Libraries / Utilities)
README
Upload To qiniu cloud webpack|vue-cli-Plugin
Qiniu Cloud scaffolding package upload plug-in package,webpack5,vue-cli4|vue-cli5 plugin
A plugin upload file to qiniu clound for vue-cli4|vue-cli5
Features
☁️ Support the latest SDK Qiniu Cloud upload, adapted to the latest VUE scaffolding CLI4.0 and 5.0 versions
💪 Suitable for the latest vue scaffolding cli4.0 and 5.0 versions, support webpack5 configuration
💪 Webpack5 configuration is supported
🚀 Incremental file upload is supported, eliminating the annoyance and waiting time of repeatedly uploading and refreshing files for all resources
Install
```bash
pnpm add webpack-plugin-qiniu-upload -D
```
```bash
yarn add webpack-plugin-qiniu-upload -D
```
Use the sample
**vue.config.js**
```js
const UploadQiNiuPlugin = require("webpack-plugin-thirdparty-upload");
const isBuildDev = process.env.buildMode === 'dev'
module.exports = {
...,
plugins: [
uploadPlugin({
sdkName: isBuildDev ? 'qiniu' : 'aws',
accessKey: isBuildDev ? process.env.QN_ACCESS_KEY : process.env.AWS_ACCESS_KEY,
secretKey: isBuildDev ? process.env.QN_SECRET_KEY : process.env.AWS_SECRET_KEY,
bucket: isBuildDev ? process.env.QN_BUCKET : process.env.AWS_BUCKET,
region: isBuildDev ? 'Zone_z2' : 'us-east-1',
awsDistributionId: 'xxxx', // aws的失效id
enabledRefresh: true,
publicPath: process.env.logBaseUrl,
uploadTarget: path.resolve(__dirname, './dist'),
appName: webpackEntry.EntryConfigs[argv.e].filename.replaceAll('.html', ''),
fileLogPath: 'log/',
env: isBuildDev ? 'development' : 'production',
htmlPath: htmlPath, // html 存到云的路径
excludeHtml: false, // 是否排除html文件
// suffix: '-v1'
})
],
};
```
Options
### qiniu cloud Options
| Name | Type | Default | Description |
| :------------------------: | :---------: | :----------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------ |
| **[`qiniuAccessKey`](#)** | `{String}` | `null` | Your Qiniu AccessKey |
| **[`qiniuSecretKey`](#)** | `{String}` | `null` | Your Qiniu SecretKey |
| **[`qiniuBucket`](#)** | `{String}` | `null` | Your Qiniu Bucket Name |
| **[`qiniuZone`](#)** | `{String}` | `null` | Your Qiniu zone code |
| **[`enabledRefresh`](#)** | `{Boolean}` | `false` | Is enable refresh the file on Qiniu Clound after file upload |
| **[`excludeHtml`](#)** | `{Boolean}` | `true` | Is exclude html file |
| **[`onlyRefreshHtml`](#)** | `{Boolean}` | `false` | only refresh html file (eg: _/demo/index.html + _/demo/), throws an exception in the case of a failure. |
| **[`prefixPath`](#)** | `{String}` | - | prefix path for the file |
| **[`fileLogPath`](#)** | `{String}` | `log/` | Provide a directory where log file should be stored |
| **[`publicPath`](#)** | `{String}` | [webpackConfig.output.publicPath](https://webpack.js.org/configuration/output/#outputpublicpath) | The prefix path to your packaged resource |
| **[`uploadTarget`](#)** | `{String}` | [webpackConfig.output.path](https://webpack.js.org/configuration/output/#output-path) | Directory of the folder to be uploaded |
| **[`appName`](#)** | `{Number}` | `Date.now()` | Optional. Name of the file used to generate resource mapping file logs |
| **[`env`](#)** | `{String}` | `development` | The environment directory corresponding to the JSON file of log |
About [qiniuZone](https://developer.qiniu.com/kodo/sdk/1289/nodejs):
## TODO LIST
- [x] Supports incremental update file upload
- [x] Supports environment With log json file
- [ ] Support log file cleaning or pull range filtering