PPJS Webpack Plugin

Introduction

A webpack plugin which runs PPJS on the input JavaScript file using the compiler "afterEmit" hook.

Installation

Install the plugin to your project:

npm install <package-directory>/ppjs-core-{version}.tgz <package-directory>/ppjs-webpack-plugin-{version}.tgz --save-dev

OR

yarn add file:<package-directory>/ppjs-core-{version}.tgz file:<package-directory>/ppjs-webpack-plugin-{version}.tgz

Note: The webpack plugin has ppjs-core as its peerDependency; this is why you must also install it.

Usage

Import the plugin in your webpack.config.js and add it to the plugins array:

const { PpjsWebpackPlugin } = require('ppjs-webpack-plugin');

// --Other configuration

plugins: [
  // --Other plugins
  new PpjsWebpackPlugin({
    inputFile: 'lib/main.js',
    outputFile: 'lib/main.protected.js',
    configurationFile: 'ppjs.config.json',
    mapFile: 'lib/main.js.map'
  })
]

Configuration

The PPJS webpack plugin accepts the same configuration file as the ppjs-cli package. You can learn more about it in the ppjs-core package's README.

Note: Right now you can only configure the minifier using a configuration file. Support for adding configuration directly in PpjsWebpackPlugin's constructor is coming in a future release.