Registry / devops / rollup-plugin-closure-compiler-js

rollup-plugin-closure-compiler-js

JSON →
library1.0.6jsnpmunverified

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.

npm install rollup-plugin-closure-compiler-js
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-CLOS
R
rollup-plugin-closure-compiler-js
devopsjavascriptv1.0.6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (closure)
import closure from 'rollup-plugin-closure-compiler-js'
const closure = require('rollup-plugin-closure-compiler-js')
ESM default export since v1.0.0.
closure (named)
import closure from 'rollup-plugin-closure-compiler-js'
import { closure } from 'rollup-plugin-closure-compiler-js'
Only default export is available; named import will fail.
PluginOptions
// No type export; use inline types or import from google-closure-compiler-js import type { CompileOptions } from 'google-closure-compiler-js'
import { PluginOptions } from 'rollup-plugin-closure-compiler-js'
This plugin does not export TypeScript types.

Basic Rollup build that minifies the bundle using closure-compiler-js with simple optimizations.

import { rollup } from 'rollup'; import closure from 'rollup-plugin-closure-compiler-js'; async function build() { const bundle = await rollup({ input: 'src/index.js', plugins: [ closure({ compilationLevel: 'SIMPLE', languageIn: 'ECMASCRIPT6', languageOut: 'ECMASCRIPT5' }) ] }); await bundle.write({ file: 'dist/bundle.js', format: 'iife', name: 'MyLib' }); } build().catch(err => console.error(err));
Debug
Known issues
deprecatedrollup-plugin-closure-compiler-js is no longer actively maintained and relies on deprecated google-closure-compiler-js.
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.
affects: all
breakinggoogle-closure-compiler-js was removed from npm in 2018; install will fail unless using a cached version.
fix
Pin version or switch to alternative minification plugins.
affects: >=1.0.0
gotchaThe plugin expects a default export from 'google-closure-compiler-js' but that package is discontinued.
fix
Ensure you have an older version of google-closure-compiler-js in node_modules (e.g., 20180219.0.0).
affects: all
gotchaOptions passed to closure() are directly forwarded to ClosureCompiler.compile() - must match that API exactly.
fix
Refer to google-closure-compiler-js documentation (archived) for valid flags.
affects: all
breakingRollup API changed from entry/plugins to input/plugins in v1.0; this plugin may not work with latest Rollup.
fix
Use Rollup <1.0 or ensure the plugin adapts; consider using a newer plugin.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'google-closure-compiler-js'
The underlying compiler package is deprecated and may not be installable from npm.
fix
Install an archived version: npm install google-closure-compiler-js@20180219.0.0 --save-dev
TypeError: closure is not a function
Using named import instead of default import (i.e., import { closure } instead of import closure).
fix
Use default import: import closure from 'rollup-plugin-closure-compiler-js'
Error: Invalid compilation level: ADVANCED
Option values must match exact string expected by closure-compiler-js.
fix
Use valid levels: 'SIMPLE', 'ADVANCED', or 'WHITESPACE_ONLY'.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies
google-closure-compiler-jsrequiredProvides the Closure Compiler JavaScript API for minification
Agent activity
7 hits · last 30 days
node
6
Resources
rollup-plugin-closure-compiler-js — npm install rollup-plugin-closure-compiler-js · libregistry