Socket
Socket
Sign inDemoInstall

webpack-aliyun-oss

Package Overview
Dependencies
146
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    webpack-aliyun-oss

a webpack plugin to upload assets to aliyun oss


Version published
Weekly downloads
106
increased by58.21%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

webpack-aliyun-oss

A webpack plugin to upload assets to aliyun oss

一个webpack插件,上传资源到阿里云cdn

Install

$ npm i webpack-aliyun-oss -S

Options

  • from: 从哪里取文件上传,默认为output.path下所有的文件。支持类似gulp.src的glob方法,如'./build/**', 可以为glob字符串或者数组。
  • dist: 上传到哪个目录下,默认为根目录。
  • region: 阿里云上传区域
  • accessKeyId: 阿里云的授权accessKeyId
  • accessKeySecret: 阿里云的授权accessKeySecret
  • bucket: 上传到哪个bucket
  • deletOrigin: 上传完成是否删除原文件,默认false
  • setHeaders: 配置headers

Example

const WebpackAliyunOss = require('webpack-aliyun-oss')
const webpackConfig = {
  // ... 省略其他
  plugins: [new WebpackAliyunOss({
    from: ['./build/**', '!./build/**/*.html'],
    dist: 'path/in/alioss',
    region: 'your region',
    accessKeyId: 'your key',
    accessKeySecret: 'your secret',
    bucket: 'your bucket',
    deleteOrigin: false,
    setHeaders(filePath) {
      return {
        'Cache-Control': 'max-age=31536000'
      }
    }
  })]
}

Keywords

FAQs

Last updated on 01 Oct 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc