{"id":22173,"library":"rollup-plugin-postprocess","title":"rollup-plugin-postprocess","description":"A Rollup plugin that applies regex-based find-and-replace postprocessing to bundle output. Version 1.0.2 is the latest stable release with minimal release cadence. It works like JavaScript String replace, supporting function callbacks and sequential replacement pairs. Differentiates from other replace plugins by operating after all other plugins, allowing transformation of the final bundle.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/developit/rollup-plugin-postprocess","tags":["javascript","rollup","plugin","replace","post replace"],"install":[{"cmd":"npm install rollup-plugin-postprocess","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-postprocess","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-postprocess","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export only; named export is not available.","wrong":"const { postprocess } = require('rollup-plugin-postprocess')","symbol":"postprocess","correct":"import postprocess from 'rollup-plugin-postprocess'"}],"quickstart":{"code":"import postprocess from 'rollup-plugin-postprocess';\n\nexport default {\n  input: 'src/index.js',\n  output: { file: 'dist/bundle.js', format: 'iife' },\n  plugins: [\n    postprocess([\n      [/\\bFIND_ME\\b/g, 'REPLACED']\n    ])\n  ]\n};","lang":"javascript","description":"Replaces all occurrences of FIND_ME with REPLACED in the final bundle using rollup-plugin-postprocess."},"warnings":[{"fix":"Use global flag in regex: /foo/g instead of just /foo/.","message":"Patterns are applied as String.replace, not RegExp replacement with full support for flags like 'g'.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Return empty string '' explicitly to keep match removal behavior clear.","message":"When using function callback for replacement, returning undefined removes the match (empty string).","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Design patterns carefully to avoid unintended interactions.","message":"Patterns are executed sequentially on the entire bundle, so later patterns can match text inserted by earlier ones.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `import postprocess from 'rollup-plugin-postprocess'`.","cause":"Named import instead of default import.","error":"TypeError: postprocess is not a function"},{"fix":"Supply an array of [regex, replacement] arrays: `postprocess([[ /pattern/, 'replacement' ]])`.","cause":"Passed an object instead of an array of arrays.","error":"Error: [object Object] is not a valid replacement pair"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}