{"id":22222,"library":"rollup-plugin-size-snapshot","title":"rollup-plugin-size-snapshot","description":"Rollup plugin that generates a .size-snapshot.json file tracking actual, minified, and gzipped bundle sizes. Current stable version v0.12.0 requires rollup >=2 and Node >=10. Key differentiator: also shows treeshaken sizes for es output via both Rollup and Webpack to detect dead code. Supports threshold for CI snapshot matching.","status":"maintenance","version":"0.12.0","language":"javascript","source_language":"en","source_url":"https://github.com/TrySound/rollup-plugin-size-snapshot","tags":["javascript"],"install":[{"cmd":"npm install rollup-plugin-size-snapshot","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-size-snapshot","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-size-snapshot","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, plugin requires rollup >=2.0.0","package":"rollup","optional":false}],"imports":[{"note":"This plugin exports a named function; default import does not work.","wrong":"import sizeSnapshot from 'rollup-plugin-size-snapshot'","symbol":"sizeSnapshot","correct":"import { sizeSnapshot } from 'rollup-plugin-size-snapshot'"},{"note":"CommonJS require must destructure the named export.","wrong":"const sizeSnapshot = require('rollup-plugin-size-snapshot')","symbol":"sizeSnapshot","correct":"const { sizeSnapshot } = require('rollup-plugin-size-snapshot')"},{"note":"This plugin does not export types; they come from Rollup itself.","wrong":"import { RollupOptions } from 'rollup-plugin-size-snapshot'","symbol":"types","correct":"import type { RollupOptions } from 'rollup'"}],"quickstart":{"code":"import { sizeSnapshot } from 'rollup-plugin-size-snapshot';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'es'\n  },\n  plugins: [\n    sizeSnapshot({\n      snapshotPath: '.size-snapshot.json',\n      printInfo: true\n    })\n  ]\n};","lang":"javascript","description":"This code shows the basic usage of the plugin with a Rollup config, outputting an ES bundle and generating a snapshot file."},"warnings":[{"fix":"Upgrade rollup to >=2.0.0","message":"v0.12.0 dropped support for rollup < 2","severity":"breaking","affected_versions":"<0.12.0"},{"fix":"Upgrade rollup to >=1.0.0","message":"v0.8.0 upgraded to rollup v1, breaking rollup < 1","severity":"breaking","affected_versions":"<0.8.0"},{"fix":"Order plugins: [sizeSnapshot(), uglify({ toplevel: true })]","message":"Place uglify/terser plugins after sizeSnapshot to get correct minified sizes","severity":"gotcha","affected_versions":">=0.5.0"},{"fix":"Set matchSnapshot: true only in CI environment, not in default config.","message":"matchSnapshot is intended for CI, not local development","severity":"gotcha","affected_versions":">=0.6.0"},{"fix":"Replace uglify with terser: import { terser } from 'rollup-plugin-terser'","message":"rollup-plugin-uglify is deprecated; use rollup-plugin-terser instead","severity":"deprecated","affected_versions":">=0.5.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install --save-dev rollup-plugin-size-snapshot","cause":"Package not installed","error":"Error: Cannot find module 'rollup-plugin-size-snapshot'"},{"fix":"Change to: import { sizeSnapshot } from 'rollup-plugin-size-snapshot'","cause":"Using default import instead of named import","error":"TypeError: sizeSnapshot is not a function"},{"fix":"npm install --save-dev terser or rollup-plugin-terser accordingly","cause":"Missing terser dependency when using minification","error":"Plugin 'size-snapshot': Cannot find module 'terser'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}