{"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,"search_vec":"'10':29 '2':26 'actual':14 'also':32 'bundl':18 'ci':51 'code':47 'current':20 'dead':46 'detect':45 'differenti':31 'es':37 'file':12 'generat':9 'gzip':17 'javascript':54 'key':30 'match':53 'minifi':15 'node':28 'output':38 'plugin':3,7 'requir':24 'rollup':2,6,25,41 'rollup-plugin-size-snapshot':1 'show':33 'size':4,19,35 'size-snapshot.json':11 'snapshot':5,52 'stabl':21 'support':48 'threshold':49 'track':13 'treeshaken':34 'v0.12.0':23 'version':22 'via':39 'webpack':43","created_at":"2026-04-27T17:04:01.807367+00:00","updated_at":"2026-04-27T17:04:01.807367+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/TrySound/rollup-plugin-size-snapshot","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-size-snapshot","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}