New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

closure-compiler-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

closure-compiler-webpack-plugin

Google Closure Compiler plugin for webpack built on the Nailgun JVM.

latest
Source
npmnpm
Version
0.1.8
Version published
Maintainers
1
Created
Source

Closure Compiler plugin for webpack

Prerequisites

  • Java 7 or higher
  • Build tools required by node-gyp for your platform

Installation

npm install closure-compiler-webpack-plugin

Example

// webpack.config.js
var ClosureCompilerPlugin = require('closure-compiler-webpack-plugin');

module.exports = {
    entry: {
        core: './core',
        home: './home'
    },
    output: {
        filename: '[name].min.js'
    },
    devtool: 'source-map',
    plugins: [
        new ClosureCompilerPlugin()
    ]
};

Options

Use Closure Compiler's flags.

// webpack.config.js
...

    plugins: [
        new ClosureCompilerPlugin({
            compilation_level: 'ADVANCED',
            create_source_map: false
            // Use 'create_source_map: false' to override your webpack 
            // config. Otherwise, anything you set for this option will be 
            // ignored in favour of your 'devtool' and filename configuration.
        })
    ]

...

For a list of available options:

java -jar node_modules/closure-compiler-webpack-plugin/node_modules/google-closure-compiler/compiler.jar --help

Shortcomings

Here are some notes, where this package could be improved. Feel free to submit PRs :)

  • For some reason, the end event from the Closure Compiler stdout stream for the output JS isn't being triggered. From my investigation, it doesn't seem to be connected to the Nailgun wrapper, but rather a problem of Closure Compiler itself. A pretty ugly hack is used to work around this issue.
  • Unlike the built-in UglifyJsPlugin, this one is heavily stream/event based, so there is some state tracking involved to signal when the last file in the compilation was processed. A promise is used, but it still doesn't seem very pretty.

Keywords

google

FAQs

Package last updated on 06 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts