{"id":26406,"library":"snowpack-plugin-closure-compiler","title":"Snowpack Closure Compiler Plugin","description":"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.","status":"maintenance","version":"1.3.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","snowpack","snowpack-plugin","google-closure-compiler","closure-compiler"],"install":[{"cmd":"npm install snowpack-plugin-closure-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add snowpack-plugin-closure-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add snowpack-plugin-closure-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to run the Closure Compiler itself.","package":"google-closure-compiler","optional":false},{"reason":"Peer dependency; plugin is designed for Snowpack v2+.","package":"snowpack","optional":false}],"imports":[{"note":"This is a CommonJS package; use require or string reference in snowpack.config.js.","wrong":"// Incorrect: trying to import as ES module\nimport plugin from 'snowpack-plugin-closure-compiler'","symbol":"default (plugin)","correct":"// snowpack.config.js\nmodule.exports = {\n  plugins: ['snowpack-plugin-closure-compiler']\n}"},{"note":"The plugin exports itself as a function; no default property.","wrong":"const scc = require('snowpack-plugin-closure-compiler').default;","symbol":"default (require)","correct":"const scc = require('snowpack-plugin-closure-compiler');\nmodule.exports = { plugins: [ [scc, { compilationLevel: 'ADVANCED' }] ] }"},{"note":"No TypeScript declarations are shipped; use JSDoc or own types.","wrong":"import { Options } from 'snowpack-plugin-closure-compiler'","symbol":"Options interface (TypeScript)","correct":"// Not exported as types; define inline\ninterface Options {\n  bundle?: boolean;\n  outputFile?: string;\n  compilationLevel?: string;\n  languageIn?: string;\n  languageOut?: string;\n}"}],"quickstart":{"code":"// Install: npm install --save-dev snowpack snowpack-plugin-closure-compiler google-closure-compiler\n// snowpack.config.js\nmodule.exports = {\n  mount: {\n    src: { url: '/dist' },\n    public: { url: '/', static: true },\n  },\n  plugins: [\n    ['snowpack-plugin-closure-compiler', {\n      compilationLevel: 'ADVANCED',\n      outputFile: 'bundle.js',\n      bundle: true,\n      languageIn: 'ECMASCRIPT_2020',\n      languageOut: 'ECMASCRIPT5',\n    }],\n  ],\n};","lang":"javascript","description":"Configures Snowpack to run Closure Compiler with advanced optimization on all JS files, outputting a single bundle.js."},"warnings":[{"fix":"Replace Snowpack with Vite and use a corresponding Vite Closure Compiler plugin (e.g., vite-plugin-closure-compiler).","message":"Snowpack itself is deprecated; consider migrating to Vite.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use with Snowpack v2 only; for v3, check compatibility or switch to another minification plugin.","message":"The plugin assumes Snowpack v2 configuration format. Snowpack v3 changed the plugin API.","severity":"breaking","affected_versions":"1.3.2"},{"fix":"Set bundle: false if you need separate output files per input.","message":"If bundle: true, Closure Compiler merges all JS into one file; you must set outputFile to a single value. Multiple output files are not supported.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using lighter minifiers like terser or esbuild for faster builds.","message":"google-closure-compiler is a heavy dependency (Java-based). Install time and build time may increase significantly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use a maintained alternative or update the underlying google-closure-compiler version manually.","message":"The plugin has not been updated since 2020; languageIn/languageOut options may not support newer ECMAScript features.","severity":"deprecated","affected_versions":"1.3.2"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install --save-dev google-closure-compiler","cause":"Missing required peer dependency google-closure-compiler.","error":"Error: Cannot find module 'google-closure-compiler'"},{"fix":"Use module.exports = { ... } instead of export default.","cause":"Snowpack config uses ES module syntax but plugin expects CommonJS.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Set outputFile to a string (e.g., 'main.js') in plugin options.","cause":"outputFile option not provided or set to undefined when bundle: true.","error":"The \"path\" argument must be of type string. Received undefined"},{"fix":"Use the string reference in plugins array: 'snowpack-plugin-closure-compiler'.","cause":"Plugin imported incorrectly (e.g., using ES import or require with .default).","error":"Plugin load error: snowpack-plugin-closure-compiler is not a plugin function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}