{"id":21953,"library":"rollup-plugin-closure-compiler-js","title":"rollup-plugin-closure-compiler-js","description":"Rollup plugin that invokes google-closure-compiler-js to optimize bundled JavaScript. Current stable version is 1.0.6, last released in 2017. The plugin wraps the deprecated google-closure-compiler-js (Java-based via Node) but users should note that google-closure-compiler-js itself was discontinued in 2018 in favor of google-closure-compiler (which uses the Java compiler natively). Key differentiators: simple Rollup integration, passes flags directly to the compiler. However, it is considered deprecated because the underlying closure-compiler-js package is no longer maintained.","status":"deprecated","version":"1.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/camelaissani/rollup-plugin-closure-compiler-js","tags":["javascript","rollup","rollup-plugin","closure-compiler","closure-compiler-js"],"install":[{"cmd":"npm install rollup-plugin-closure-compiler-js","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-closure-compiler-js","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-closure-compiler-js","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides the Closure Compiler JavaScript API for minification","package":"google-closure-compiler-js","optional":false}],"imports":[{"note":"ESM default export since v1.0.0.","wrong":"const closure = require('rollup-plugin-closure-compiler-js')","symbol":"default (closure)","correct":"import closure from 'rollup-plugin-closure-compiler-js'"},{"note":"Only default export is available; named import will fail.","wrong":"import { closure } from 'rollup-plugin-closure-compiler-js'","symbol":"closure (named)","correct":"import closure from 'rollup-plugin-closure-compiler-js'"},{"note":"This plugin does not export TypeScript types.","wrong":"import { PluginOptions } from 'rollup-plugin-closure-compiler-js'","symbol":"PluginOptions","correct":"// No type export; use inline types or import from google-closure-compiler-js\nimport type { CompileOptions } from 'google-closure-compiler-js'"}],"quickstart":{"code":"import { rollup } from 'rollup';\nimport closure from 'rollup-plugin-closure-compiler-js';\n\nasync function build() {\n  const bundle = await rollup({\n    input: 'src/index.js',\n    plugins: [\n      closure({\n        compilationLevel: 'SIMPLE',\n        languageIn: 'ECMASCRIPT6',\n        languageOut: 'ECMASCRIPT5'\n      })\n    ]\n  });\n  await bundle.write({\n    file: 'dist/bundle.js',\n    format: 'iife',\n    name: 'MyLib'\n  });\n}\n\nbuild().catch(err => console.error(err));","lang":"typescript","description":"Basic Rollup build that minifies the bundle using closure-compiler-js with simple optimizations."},"warnings":[{"fix":"Use @rollup/plugin-terser or rollup-plugin-esbuild for minification, or switch to the newer google-closure-compiler package with its own rollup plugin.","message":"rollup-plugin-closure-compiler-js is no longer actively maintained and relies on deprecated google-closure-compiler-js.","severity":"deprecated","affected_versions":"all"},{"fix":"Pin version or switch to alternative minification plugins.","message":"google-closure-compiler-js was removed from npm in 2018; install will fail unless using a cached version.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure you have an older version of google-closure-compiler-js in node_modules (e.g., 20180219.0.0).","message":"The plugin expects a default export from 'google-closure-compiler-js' but that package is discontinued.","severity":"gotcha","affected_versions":"all"},{"fix":"Refer to google-closure-compiler-js documentation (archived) for valid flags.","message":"Options passed to closure() are directly forwarded to ClosureCompiler.compile() - must match that API exactly.","severity":"gotcha","affected_versions":"all"},{"fix":"Use Rollup <1.0 or ensure the plugin adapts; consider using a newer plugin.","message":"Rollup API changed from entry/plugins to input/plugins in v1.0; this plugin may not work with latest Rollup.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install an archived version: npm install google-closure-compiler-js@20180219.0.0 --save-dev","cause":"The underlying compiler package is deprecated and may not be installable from npm.","error":"Cannot find module 'google-closure-compiler-js'"},{"fix":"Use default import: import closure from 'rollup-plugin-closure-compiler-js'","cause":"Using named import instead of default import (i.e., import { closure } instead of import closure).","error":"TypeError: closure is not a function"},{"fix":"Use valid levels: 'SIMPLE', 'ADVANCED', or 'WHITESPACE_ONLY'.","cause":"Option values must match exact string expected by closure-compiler-js.","error":"Error: Invalid compilation level: ADVANCED"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}