# webpack-command-plugin

> Run shell commands before and after webpack builds

Latest version **1.0.1** (published 2019-11-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-command-plugin
pnpm add webpack-command-plugin
yarn add webpack-command-plugin
bun add webpack-command-plugin
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-11-09 |
| First published | 2019-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | chenjunhong |
| Maintainers | p455555555 |
| Keywords | webpack, shell, command, plugin |

## Links

- npm: https://www.npmjs.com/package/webpack-command-plugin
- Repository: https://github.com/p455555555/webpack-command-plugin
- Issues: https://github.com/p455555555/webpack-command-plugin/issues
- npm.io page: https://npm.io/package/webpack-command-plugin

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-11-09
- 1.0.0 — 2019-11-09
- 0.0.1 — 2019-11-09

## README

[![npm version](https://badge.fury.io/js/webpack-command-plugin.svg)](https://badge.fury.io/js/webpack-command-plugin)

# Webpack Command Plugin

这个是[WebpackShellPlugin](https://github.com/1337programming/webpack-shell-plugin)的TypeScript重构版，以webpack4新hooks API为基础重构,API用法保持不变.

## 安装

`npm install --save-dev webpack-command-plugin`

## 用法
In `webpack.config.js`:

```js
const WebpackCommandPlugin = require('webpack-command-plugin');

module.exports = {
  ...
  ...
  plugins: [
    new WebpackCommandPlugin({onBuildStart:'echo "Webpack Start"', onBuildEnd:'echo "Webpack End"'})
  ],
  ...
}
```

## 示例

Insert into your webpack.config.js:

```js
const WebpackCommandPlugin = require('webpack-command-plugin');
const path = require('path');

var plugins = [];

plugins.push(new WebpackCommandPlugin({
  onBuildStart: 'echo "Starting"',
  onBuildEnd: 'python script.py && node script.js'
}));

var config = {
  entry: {
    app: path.resolve(__dirname, 'src/app.js')
  },
  output: {
    path: path.resolve(__dirname, 'dist'), // regular webpack
    filename: 'bundle.js'
  },
  devServer: {
    contentBase: path.resolve(__dirname, 'src') // dev server
  },
  plugins: plugins,
  module: {
    loaders: [
      {test: /\.js$/, loaders: 'babel'},
      {test: /\.scss$/, loader: 'style!css!scss?'},
      {test: /\.html$/, loader: 'html-loader'}
    ]
  }
}

module.exports = config;

```

---
_Source: https://npm.io/package/webpack-command-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
