Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roman01la/webpack-closure-compiler
[DEPRECATED] Google Closure Compiler plugin for Webpack
https://github.com/roman01la/webpack-closure-compiler
closure-compiler optimization tree-shaking webpack-closure-compiler
Last synced: about 2 months ago
JSON representation
[DEPRECATED] Google Closure Compiler plugin for Webpack
- Host: GitHub
- URL: https://github.com/roman01la/webpack-closure-compiler
- Owner: roman01la
- License: mit
- Archived: true
- Created: 2015-07-13T11:36:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-09-11T19:15:25.000Z (over 5 years ago)
- Last Synced: 2024-05-02T04:40:58.083Z (8 months ago)
- Topics: closure-compiler, optimization, tree-shaking, webpack-closure-compiler
- Language: JavaScript
- Homepage:
- Size: 32.9 MB
- Stars: 465
- Watchers: 11
- Forks: 25
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [DEPRECATED]
## This project is deprecated in favor of official Webpack plugin [webpack-contrib/closure-webpack-plugin](https://github.com/webpack-contrib/closure-webpack-plugin)
# webpack-closure-compiler
Google Closure Compiler plugin for Webpack## Table of Contents
- [Why use Closure Compiler instead of UglifyJS?](#why-use-closure-compiler-instead-of-uglifyjs)
- [Installation](#installation)
- [Requirements](#requirements)
- [Usage](#usage)
- [Handbook](#handbook)
- [Contributing](#contributing)## Why use Closure Compiler instead of UglifyJS?
Closure Compiler is the most advanced JavaScript optimization tool. It generates smallest bundle and emits efficient JavaScript code by doing whole program analysis and optimization, removing closures and inlining function calls, as well as tree-shaking for AMD, CommonJS and ES2015 modules.## Installation
```bash
npm i -D webpack-closure-compiler
```## Requirements
While there's JavaScript version of Closure Compiler, the original compiler is written in Java and thus Java version is more complete and performs better in terms of JavaScript code optimizations and compilation speed. If you want to use Java-based compiler, make sure you have installed [Java SDK](http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html).## Usage
### Options
#### compiler: <Object>
A hash of options to pass to
[google-closure-compiler](https://github.com/google/closure-compiler-npm#specifying-options).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`.
### Example
```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,
})
]
};
```## Handbook
Read [Closure Compiler Handbook](https://github.com/roman01la/closure-compiler-handbook) to you understand how to use Closure Compiler and learn its features.## Contributing
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.
## License
MIT