Registry / devops / snowpack-plugin-closure-compiler

snowpack-plugin-closure-compiler

JSON →
library1.3.2jsnpmunverified

Snowpack plugin (v1.3.2) that processes JavaScript assets through Google Closure Compiler for minification and static analysis. Requires Node >=8 and Snowpack >=2.0.0. Supports BUNDLE, WHITESPACE_ONLY, SIMPLE, ADVANCED compilation levels, ECMAScript version control via languageIn/languageOut, and custom output file name. Not under active development; last release in 2020.

npm install snowpack-plugin-closure-compiler
INSTALL
IMPORT
SIG · SNOWPACK-PLUGIN-CL
S
snowpack-plugin-closure-compiler
devopsjavascriptv1.3.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default (plugin)
// snowpack.config.js module.exports = { plugins: ['snowpack-plugin-closure-compiler'] }
// Incorrect: trying to import as ES module import plugin from 'snowpack-plugin-closure-compiler'
This is a CommonJS package; use require or string reference in snowpack.config.js.
default (require)
const scc = require('snowpack-plugin-closure-compiler'); module.exports = { plugins: [ [scc, { compilationLevel: 'ADVANCED' }] ] }
const scc = require('snowpack-plugin-closure-compiler').default;
The plugin exports itself as a function; no default property.
Options interface (TypeScript)
// Not exported as types; define inline interface Options { bundle?: boolean; outputFile?: string; compilationLevel?: string; languageIn?: string; languageOut?: string; }
import { Options } from 'snowpack-plugin-closure-compiler'
No TypeScript declarations are shipped; use JSDoc or own types.

Configures Snowpack to run Closure Compiler with advanced optimization on all JS files, outputting a single bundle.js.

// Install: npm install --save-dev snowpack snowpack-plugin-closure-compiler google-closure-compiler // snowpack.config.js module.exports = { mount: { src: { url: '/dist' }, public: { url: '/', static: true }, }, plugins: [ ['snowpack-plugin-closure-compiler', { compilationLevel: 'ADVANCED', outputFile: 'bundle.js', bundle: true, languageIn: 'ECMASCRIPT_2020', languageOut: 'ECMASCRIPT5', }], ], };
Debug
Known issues
deprecatedSnowpack itself is deprecated; consider migrating to Vite.
fix
Replace Snowpack with Vite and use a corresponding Vite Closure Compiler plugin (e.g., vite-plugin-closure-compiler).
affects: >=2.0.0
breakingThe plugin assumes Snowpack v2 configuration format. Snowpack v3 changed the plugin API.
fix
Use with Snowpack v2 only; for v3, check compatibility or switch to another minification plugin.
affects: 1.3.2
gotchaIf bundle: true, Closure Compiler merges all JS into one file; you must set outputFile to a single value. Multiple output files are not supported.
fix
Set bundle: false if you need separate output files per input.
affects: >=1.0.0
gotchagoogle-closure-compiler is a heavy dependency (Java-based). Install time and build time may increase significantly.
fix
Consider using lighter minifiers like terser or esbuild for faster builds.
affects: >=1.0.0
deprecatedThe plugin has not been updated since 2020; languageIn/languageOut options may not support newer ECMAScript features.
fix
Use a maintained alternative or update the underlying google-closure-compiler version manually.
affects: 1.3.2
Errors
Common errors & fixes
Error: Cannot find module 'google-closure-compiler'
Missing required peer dependency google-closure-compiler.
fix
npm install --save-dev google-closure-compiler
SyntaxError: Unexpected token 'export'
Snowpack config uses ES module syntax but plugin expects CommonJS.
fix
Use module.exports = { ... } instead of export default.
The "path" argument must be of type string. Received undefined
outputFile option not provided or set to undefined when bundle: true.
fix
Set outputFile to a string (e.g., 'main.js') in plugin options.
Plugin load error: snowpack-plugin-closure-compiler is not a plugin function
Plugin imported incorrectly (e.g., using ES import or require with .default).
fix
Use the string reference in plugins array: 'snowpack-plugin-closure-compiler'.
Upgrade
Version history
1.3.2latest on npm
Audit
Dependencies
google-closure-compilerrequiredRequired to run the Closure Compiler itself.
snowpackrequiredPeer dependency; plugin is designed for Snowpack v2+.
Agent activity
2 hits · last 30 days
node
2
Resources
snowpack-plugin-closure-compiler — npm install snowpack-plugin-closure-compiler · libregistry