Skip to content

itgalaxy/execa-webpack-plugin

Repository files navigation

execa-webpack-plugin

NPM version Travis Build Status dependencies Status devDependencies Status Greenkeeper badge

A better child_process for webpack.

Installation

npm i -D execa-webpack-plugin

Usage

webpack.config.js

const ExecaPlugin = require("execa-webpack-plugin");

module.exports = {
  plugins: [
    new ExecaPlugin({
      onBuildStart: [
        {
          args: ["build"],
          cmd: "del"
        }
      ]
    })
  ]
};

Options

Name Type Default Description
onBuildStart {Array} [] Array of scripts to execute on the initial build.
onBuildEnd {Array} [] Array of scripts to execute after files are emitted at the end of the compilation.
onBuildExit {Array} [] array of scripts to execute after webpack's process is complete.
bail {Boolean} compiler.options.bail Report the first error as a hard error instead of tolerating it.
dev {Boolean} true Switch for development environments. This causes scripts to execute once. Useful for running HMR on webpack-dev-server or webpack watch mode.
logLevel string warn Enable logging.

onBuildStart

[
  new ExecaPlugin({
    onBuildStart: [
      {
        args: ["build"],
        cmd: "del"
      }
    ]
  })
];

onBuildEnd

[
  new ExecaPlugin({
    onBuildEnd: [
      {
        args: ["trash"],
        cmd: "del"
      }
    ]
  })
];

onBuildExit

[
  new ExecaPlugin({
    onBuildExit: [
      {
        args: ["trash"],
        cmd: "del"
      }
    ]
  })
];

bail

[
  new ExecaPlugin({
    bail: true,
    onBuildStart: [
      {
        args: ["build"],
        cmd: "del"
      }
    ]
  })
];

dev

[
  new ExecaPlugin({
    dev: true,
    onBuildStart: [
      {
        args: ["build"],
        cmd: "del"
      }
    ]
  })
];

logLevel

[
  new ExecaPlugin({
    logLevel: "info",
    onBuildStart: [
      {
        args: ["build"],
        cmd: "del"
      }
    ]
  })
];

Thanks

About

A better `child_process` for `webpack`

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published