{"id":41975,"library":"snowpack-plugin-optimize","title":"snowpack-plugin-optimize","description":"A Snowpack plugin that minifies JS (via terser), CSS (via csso), and HTML (via html-minifier) for production builds. Supports source map generation/remapping, optional modulepreload injection, and TypeScript declaration files. Version 0.5.0 (last release June 2020) works with Snowpack ^2.17.1 and is in maintenance mode, as Snowpack has since been deprecated in favor of Vite. It does not bundle; for bundling the official webpack plugin is recommended.","status":"maintenance","version":"0.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/TylorS/snowpack-plugin-optimize","tags":["javascript","snowpack","plugin","optimize","terser","csso","html-minifier","minify","sourceMap","typescript"],"install":[{"cmd":"npm install snowpack-plugin-optimize","lang":"bash","label":"npm"},{"cmd":"yarn add snowpack-plugin-optimize","lang":"bash","label":"yarn"},{"cmd":"pnpm add snowpack-plugin-optimize","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: requires Snowpack >=2.17.1 as the build tool","package":"snowpack","optional":false}],"imports":[{"note":"Always use the plugin reference as a string in the array syntax; direct require may not be resolved correctly by Snowpack.","wrong":"plugins: [require('snowpack-plugin-optimize')]","symbol":"plugin","correct":"plugins: [['snowpack-plugin-optimize', options]]"}],"quickstart":{"code":"// snowpack.config.js\nmodule.exports = {\n  plugins: [\n    [\n      'snowpack-plugin-optimize',\n      {\n        minifyJs: true,\n        minifyCss: true,\n        minifyHtml: true,\n        jsOptions: {\n          sourceMap: true,\n          compress: { ecma: 2019 },\n          format: { ecma: 2019 }\n        },\n        cssOptions: {\n          sourceMap: true\n        },\n        htmlOptions: {\n          collapseWhitespace: true,\n          keepClosingSlash: true,\n          removeComments: true\n        },\n        modulePreload: true\n      }\n    ]\n  ]\n}","lang":"javascript","description":"Snowpack config enabling minification for JS, CSS, and HTML with source maps and modulepreload."},"warnings":[{"fix":"Ensure your config uses the array form: ['snowpack-plugin-optimize', opt]","message":"Snowpack 3+ removed support for plugin string shorthand – you must use the array syntax [name, options].","severity":"gotcha","affected_versions":">=0.5.0"},{"fix":"Migrate to Vite and use vite-plugin-optimize or similar.","message":"Snowpack itself is deprecated in favor of Vite. This plugin will not receive updates for newer build tools.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Always wrap options in an array: ['snowpack-plugin-optimize', { ... }]","message":"The plugin silently ignores options if the plugin string is not placed in an array; common mistake with nested configs.","severity":"gotcha","affected_versions":">=0.5.0"}],"env_vars":null,"search_vec":"'0.5.0':37 '2.17.1':45 '2020':41 'build':24 'bundl':64,66 'css':13 'csso':15,78 'declar':34 'deprec':56 'favor':58 'file':35 'generation/remapping':28 'html':17,20,80 'html-minifi':19,79 'inject':31 'javascript':73 'js':10 'june':40 'last':38 'mainten':49 'map':27 'minifi':9,21,81,82 'mode':50 'modulepreload':30 'offici':68 'optim':4,76 'option':29 'plugin':3,7,70,75 'product':23 'recommend':72 'releas':39 'sinc':54 'snowpack':2,6,44,52,74 'snowpack-plugin-optim':1 'sourc':26 'sourcemap':83 'support':25 'terser':12,77 'typescript':33,84 'version':36 'via':11,14,18 'vite':60 'webpack':69 'work':42","created_at":"2026-06-04T18:55:01.291438+00:00","updated_at":"2026-06-04T18:55:01.291438+00:00","problems":[{"fix":"npm install --save-dev snowpack-plugin-optimize","cause":"Plugin not installed as devDependency","error":"Error: Cannot find module 'snowpack-plugin-optimize'"},{"fix":"Provide jsOptions as an object with sourceMap:true if source maps are enabled","cause":"Terser options not merged correctly; jsOptions may be missing or invalid","error":"TypeError: Cannot read property 'module' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/TylorS/snowpack-plugin-optimize#readme","github":"https://github.com/TylorS/snowpack-plugin-optimize","docs":null,"changelog":null,"pypi":null,"npm":"snowpack-plugin-optimize","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}