scripting-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Scripting Webpack Plugin

A simple webpack extension built in Typescript for running scripts during the emission phase in Webpack's compilation process.

Features

Scripting Language Support:

Supports running bash / python / js script files! simply declare what shell to execute your script in!

Event-based Execution

Supports running scripts based on different compiler hook events. Currently support compiler hooks are as follows:

  • onShouldEmit (compiler.hooks.shouldEmit)
  • onEmit (compiler.hooks.emit)
  • onAfterEmit (compiler.hooks.afterEmit)

Installation

install via npm with the following cmd string:

npm i -D scripting-webpack-plugin

begin using in your webpack.config.js file as so:

const ScriptingWebpackPlugin = require('scripting-webpack-plugin')

Usage

A simple ScriptingWebpackPlugin configuration looks like the following:

const ScriptingWebpackPlugin = require('scripting-webpack-plugin')

// ...
// Your Webpack Configuration...
// ...

    plugins: [
        new ScriptingWebpackPlugin({
            scripts: {
                onEmit: [{
                    script: './scripts/build/chrome/build.sh',
                    args: 'target=chrome'
                },{
                    shell: 'node',
                    script: './scripts/build/chrome/crx.js'
                }],
                onShouldEmit: [{
                    script: './scripts/performance/performance.sh',
                    args: 'threshold=5000ms'
                }]
            },
            shell: 'bash',
            verbose: true
        })
    ]

you can refer to the example webpack.config.js build file for more help!

Contributing

We welcome contributions to the project! Please read our Contributing Guidelines for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependents (0)

Package Sidebar

Install

npm i scripting-webpack-plugin

Weekly Downloads

9

Version

1.0.2

License

MIT

Unpacked Size

34 kB

Total Files

16

Last publish

Collaborators

  • h8ngrydev4hire