A Webpack plugin that integrates Google Closure Compiler for advanced JavaScript optimization, including dead code elimination, function inlining, and tree-shaking for AMD, CommonJS, and ES2015 modules. The current stable version is 2.1.6, with sporadic releases. It is one of the few plugins to offer Closure Compiler's ADVANCED mode optimizations directly in Webpack, producing smaller bundles than UglifyJS. It supports both Java-based and pure JavaScript (jsCompiler) modes, with concurrency options for parallel compilation. Maintained as open-source, but note limited activity and no recent major updates.
npm install webpack-closure-compilerVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic Webpack configuration using webpack-closure-compiler with ADVANCED optimizations and parallel compilation.
Run: npm i -D google-closure-compiler
Use default Java mode unless you cannot install Java.
Do not set both concurrency and jsCompiler; choose one concurrency mode.
Use a newer alternative or test with Webpack 5; consider terra-untitled/webpack-closure-compiler fork.
Use webpack's module.rules to process only certain files.
Run: npm install --save-dev google-closure-compiler
Use: new ClosureCompilerPlugin({...})Install Java SDK or add jsCompiler: true to plugin options.
Ensure you pass an object with 'compiler' key: new ClosureCompilerPlugin({ compiler: {...} })