Java platform distribution of Google's Closure Compiler, a JavaScript optimizer and minifier that produces highly efficient code. This package wraps the Closure Compiler Java library for use in Node.js environments. Current stable version is 20260428.0.0, released weekly alongside upstream Closure Compiler versions. Key differentiators: full Closure Compiler functionality (type checking, optimization, dead code elimination) via Java runtime; suitable for build pipelines; no GraalVM native-image dependency unlike the native platform packages. Compares to other minifiers (Terser, UglifyJS) by offering advanced compilation passes, strict type checking, and cross-module optimization.
npm install google-closure-compiler-javaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: compile a simple JavaScript string with advanced optimizations, handling errors.
Install Java Runtime Environment (JRE) 8+ and ensure java is on PATH.
Use google-closure-compiler which includes platform-specific native images if Java not desired.
Use in-memory compilation and write output manually if needed.
Use exact values: 'WHITESPACE_ONLY', 'SIMPLE', 'ADVANCED'.
Always check result.errors array length before using result.code.
Install Java 8+ (e.g., from adoptopenjdk.net) and ensure 'java -version' works in terminal.
Run 'npm install google-closure-compiler-java' and use correct import: import compiler from 'google-closure-compiler-java'.
Use import { compile } from 'google-closure-compiler-java' or import compiler from ... then compiler.compile().