dao-aliyun-oss-webpack-plugin

1.0.3 • Public • Published

dao-aliyun-oss-webpack-plugin

基于webpack 的aliyun OSS上传工具

如何使用

  1. 安装daoAliyunOssWebpackPlugin
$ npm i dao-aliyun-oss-webpack-plugin -D
  1. 配置webpack.config.js
<!-- 在头部引入插件 -->
var daoAliyunOssWebpackPlugin = require("dao-aliyun-oss-webpack-plugin");
<!-- 配置plugins -->
.....
plugins: [
    new daoAliyunOssWebpackPlugin({
        buildPath: 'dist', //本地需要上传路径
        ossPath:'test',//上传存放目录(存储空间内部)
        region: 'oss-cn-beijing',//区域
        accessKeyId: 'xxxxxxxx',
        accessKeySecret: 'xxxxxxxxxxxxxxxxx',
        bucket: 'cdn'//存储空间
    })
]
  1. 如其他环境如vue.config.js

let env = process.env.NODE_ENV == "development" ? "development" : "production";

module.exports = {
   ......
   configureWebpack: config => {
          // 为生产环境修改配置...
          if (env) {
            config.plugins.push(
                new daoAliyunOssWebpackPlugin({
                    buildPath: 'dist', //本地需要上传路径
                    ossPath:'test',//上传存放目录(存储空间内部)
                    region: 'oss-cn-beijing',//区域
                    accessKeyId: 'xxxxxxxx',
                    accessKeySecret: 'xxxxxxxxxxxxxxxxx',
                    bucket: 'cdn'//存储空间
                })
            )
        }
   }
   ......

Package Sidebar

Install

npm i dao-aliyun-oss-webpack-plugin

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

6.1 kB

Total Files

3

Last publish

Collaborators

  • daoxin