{"library":"rollup-plugin-regexp","title":"rollup-plugin-regexp","description":"A Rollup plugin for dynamic find-and-replace operations in bundled output using regular expressions or string matching. Version 5.0.1 is the latest stable release, published with a moderate cadence. Unlike static string replacement plugins, it supports RegExp patterns and replacement functions, enabling codemods and dynamic content injection. Ships TypeScript types and uses magic-string for accurate sourcemap preservation. A key differentiator is the shorthand syntax allowing key-value pairs for multiple replacements.","language":"javascript","status":"active","last_verified":"Mon Apr 27","install":{"commands":["npm install rollup-plugin-regexp"],"cli":null},"imports":["import regexpPlugin from 'rollup-plugin-regexp'","import { RegexpPlugin } from 'rollup-plugin-regexp'","import type { RollupRegexpOptions } from 'rollup-plugin-regexp'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import regexpPlugin from 'rollup-plugin-regexp';\nimport { defineConfig } from 'rollup';\n\nexport default defineConfig({\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    regexpPlugin({\n      find: /process\\.env\\.MY_VAR/g,\n      replace: () => JSON.stringify(process.env.MY_VAR ?? 'default')\n    }),\n    // Multiple replacements shorthand:\n    regexpPlugin({\n      '__BUILD_TIME__': new Date().toISOString(),\n      '__VERSION__': '1.0.0'\n    })\n  ]\n});","lang":"typescript","description":"Shows default import, a regex replacement using a function, and the shorthand multiple replacement syntax.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}