Google Closure Compiler plugin for Webpack 4+
Last updated 2 years ago by aqours .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @semibold/closure-compiler-plugin 
SYNC missed versions from official npm registry.




npm i -D @semibold/closure-compiler-plugin


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.



compiler: <Object>

A hash of options to pass to google-closure-compiler(Flags and 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: <Number>

The maximum number of compiler instances to run in parallel, defaults to 1.

test: <RegExp | RegExp[]>

Process only files which filename satisfies specified RegExp, defaults to /\.js($|\?)/i.


const path = require("path");
const ClosureCompilerPlugin = require("@semibold/closure-compiler-plugin");

module.exports = {
    entry: path.join(__dirname, "app.js"),
    output: {
        path: path.join(__dirname, "dist"),
        filename: "[name].min.js",
    mode: "production",
    devtool: "source-map",
    plugins: [
        new ClosureCompilerPlugin({
            compiler: {
                jar: "path/to/your/custom/compiler.jar", // Optional
                language_in: "ECMASCRIPT6",
                language_out: "ECMASCRIPT5",
                compilation_level: "ADVANCED",
                isolation_mode: "IIFE",
                create_source_map: true,
                externs: [path.join(__dirname, "externs.js")],
    optimization: {
        minimize: false,


Current Tags

  • 4.0.0                                ...           latest (2 years ago)

1 Versions

  • 4.0.0                                ...           2 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (7)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |