[go: up one dir, main page]

sa-webpack-zip-plugin

1.0.2 • Public • Published

Webpack Zip Plugin

This plugin zip your dist after webpack builds.

Install

npm install --save-dev webpack-zip-plugin

Quick Start

Insert into your webpack.config.js:

const WebpackZipPlugin = require('webpack-zip-plugin')
 
module.exports = {
  ...
  plugins: [
    new WebpackZipPlugin({
      frontShell: 'ls'
      initialFile: './dist',
      endPath: './buildPath',
      zipName: '[name].zip',
      behindShell: 'scp ***'
    })
  ]
}
 

Example

const path = require('path')
const webpack = require('webpack')
 
const WebpackZipPlugin = require('webpack-zip-plugin')
 
module.exports = {
  entry: './test/entry.js',
  output: {
    path: path.resolve(__dirname, 'dist/'),
    filename: '[name].js'
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        use: ['babel-loader'],
        exclude: /(node_modules)/
      }
    ]
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new WebpackZipPlugin({
      frontShell: 'ls && pwd',
      initialFile: 'dist',
      endPath: './',
      zipName: 'zipName.zip',
      behindShell: 'scp dist.zip www@*.*.*.*:/root/'
    })
  ]
}

API

  • initialFile: Need to pack the target file, excluding the file itself Default: ''
  • endPath: Packaged file directory Default: ''
  • zipName: Zip package name Default: ''
  • frontShell: Zip front commands Default: ''
  • behindShell: Zip behind commands Default: ''

LICENSE

MIT

Readme

Keywords

Package Sidebar

Install

npm i sa-webpack-zip-plugin

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

14.8 kB

Total Files

11

Last publish

Collaborators

  • saqqdy