Socket
Socket
Sign inDemoInstall

webpack-nexus-upload-plugin

Package Overview
Dependencies
139
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    webpack-nexus-upload-plugin

upload webpack compiled file with your own way, such as OSS, S3 etc.


Version published
Maintainers
1
Install size
6.35 MB
Created

Readme

Source

webpack-nexus-upload-plugin

webpack plugin for detail the files of webpack compiled with your own way, such as OSS, S3 etc.

Features

use this plugin, the webpack compiled files are processed again. Upload to OSS, S3, or local disk,the default is built-in alioss.

Installation

$ npm install --save webpack-nexus-upload-plugin

Usage

Add new plugin instance to your webpack config

const SourceUploaderWebpackPlugin = require('source-uploader-webpack-plugin');

  const compiler = webpack({
  	output: {
      publicPath: "your cdn path"
  	},
    // ...
    plugins: [
      new SourceUploaderWebpackPlugin({
      	  path: paths.appBuild,
      	  aliOSS: {
              region: '<Your region>',
              accessKeyId: '<Your AccessKeyId>',
              accessKeySecret: '<Your AccessKeySecret>',
              bucket: 'Your bucket name',
              fileDir: 'file path on alioss'
      	  },
      	  upload: function(filename, source) {
          	// dosomthing with file source
            console.log(source)
      	  }
      )
    ]
  })

Configuration

The plugin accepts the following options:

  • path: Your application build path(output->path), for generate the local html file.

  • aliOSS: aliOSS options.

    region: ''

    accessKeyId: ''

    accessKeySecret: ''

    bucket: 'Your bucket name'

    fileDir: 'file path on alioss'

  • upload: Your own callback function, accept two parameters:

    @param filename: include the build path, for example static/js/main.js @param source: the file source

    @return true/false, true is upload success, on the contrary is upload failed

    Notice

    • If you use aliOSS, you can configure aliOSS, also you can use upload callback, in the callback function, you can write you own code implementation.
    • publicPath in webpack should be your cdn path, the compiled file will be replaced with this path.

License

MIT

Keywords

FAQs

Last updated on 15 Sep 2017

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