{"id":25644,"library":"google-closure-compiler-macos","title":"Google Closure Compiler - Mac OS Native","description":"Mac OS native binary distribution of the Google Closure Compiler, a JavaScript optimizer and minifier. Version 20260428.0.0 corresponds to the Closure-Compiler release 20260428. Frequent updates (weekly). This package is one of platform-specific packages; the main entry point is 'google-closure-compiler'. It automatically detects the platform and installs the appropriate binary. Key differentiator: provides a native Java binary for macOS (x64 and arm64) instead of requiring a separate Java runtime installation, but still requires Java to be available. Unlike other minifiers (Terser, esbuild), it performs advanced optimizations like type-based inlining and dead code elimination. Not intended for direct import; use the main package.","status":"active","version":"20260428.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/ChadKillingsworth/closure-compiler-npm","tags":["javascript","compiler","optimizer","minifier","closure","java"],"install":[{"cmd":"npm install google-closure-compiler-macos","lang":"bash","label":"npm"},{"cmd":"yarn add google-closure-compiler-macos","lang":"bash","label":"yarn"},{"cmd":"pnpm add google-closure-compiler-macos","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Main distribution package; this platform package is typically installed as a dependency of the main package.","package":"google-closure-compiler","optional":false}],"imports":[{"note":"Do not import directly from platform-specific package. Use the main 'google-closure-compiler' package.","wrong":"import { compile } from 'google-closure-compiler-macos'","symbol":"compile","correct":"import { compile } from 'google-closure-compiler'"},{"note":"Default export from main package. Avoid platform-specific imports.","wrong":"import closureCompiler from 'google-closure-compiler-macos'","symbol":"closureCompiler","correct":"import closureCompiler from 'google-closure-compiler'"}],"quickstart":{"code":"// Install: npm install google-closure-compiler\n\nimport { compile } from 'google-closure-compiler';\n\nconst compilation = await compile({\n  compilation_level: 'ADVANCED',\n  js: ['src/**/*.js'],\n  js_output_file: 'dist/bundle.min.js',\n  language_in: 'ECMASCRIPT_2020',\n  language_out: 'ECMASCRIPT5',\n  rewrite_polyfills: false,\n});\n\nif (compilation.errors) {\n  console.error('Compilation errors:', compilation.errors);\n} else {\n  console.log('Compiled output:', compilation.outputFiles);\n}","lang":"typescript","description":"Shows how to use the main package's compile function with common options for advanced optimization."},"warnings":[{"fix":"npm install google-closure-compiler","message":"Install the main 'google-closure-compiler' package, not the platform-specific package like 'google-closure-compiler-macos'.","severity":"gotcha","affected_versions":"*"},{"fix":"Install Java 8 or later (e.g., via OpenJDK).","message":"Java is required at runtime; the package only provides the closure-compiler.jar and a Java wrapper. Ensure Java 8+ is installed.","severity":"breaking","affected_versions":"*"},{"fix":"Do not manually install platform packages; let the main package handle it.","message":"The compiler binary is platform-specific; the main package automatically selects the correct platform package (linux, macos, or windows).","severity":"gotcha","affected_versions":">=20200000"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: npm install google-closure-compiler","cause":"Installed the platform package instead of the main package.","error":"Error: Cannot find module 'google-closure-compiler-macos'"},{"fix":"Install OpenJDK 8+ and add 'java' to PATH.","cause":"Java runtime is not installed.","error":"Error: Java not found. Please install Java and ensure it is in your PATH."},{"fix":"Install the main package: npm install google-closure-compiler","cause":"Using macos package on non-Mac OS.","error":"Error: The platform \"win32\" is incompatible with this module."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}