Google Closure Compiler plugin for Webpack
npm install webpack-closure-compiler
``bash`
npm i -D webpack-closure-compiler
#### compiler: <Object>
A hash of options to pass to
google-closure-compiler.
You can optionally specify a path to your own version of the compiler.jar if the version provided by the plugin isn't working for you. See example below for optional parameter.
#### jsCompiler: <Boolean>
Use pure JavaScript version of Closure Compiler (no Java dependency). Note that compilation time will be around 2x slower. Default is false. concurrency and jsCompiler options are mutually exclusive.
#### concurrency: <Number>
The maximum number of compiler instances to run in parallel, defaults to 1. concurrency and jsCompiler options are mutually exclusive.
#### test: <RegExp>
Process only files which filename satisfies specified RegExp, defaults to /\.js($|\?)/i.
`js
const path = require('path');
const ClosureCompilerPlugin = require('webpack-closure-compiler');
module.exports = {
entry: [
path.join(__dirname, 'app.js')
],
output: {
path: path.join(__dirname, '/'),
filename: 'app.min.js'
},
plugins: [
new ClosureCompilerPlugin({
compiler: {
jar: 'path/to/your/custom/compiler.jar', //optional
language_in: 'ECMASCRIPT6',
language_out: 'ECMASCRIPT5',
compilation_level: 'ADVANCED'
},
concurrency: 3,
})
]
};
``
If you've spotted a bug, please, open an issue, and after discussion submit a pull request with a bug fix. If you would like to add a feature or change existing behaviour, open an issue and tell about what exactly you want to change/add.
MIT