{"id":22192,"library":"rollup-plugin-re","title":"rollup-plugin-re","description":"A Rollup plugin for content transformation using regex patterns, string replacements, define macros, and custom transforms. Version 1.0.7 is the latest stable release, but the package appears unmaintained since 2018. It allows multiple replace patterns, include/exclude filters, and supports replacing by regex, string, file content, or custom transform function. Differentiates from @rollup/plugin-replace by offering pattern-based and macro-based replacements alongside simple string replacements.","status":"deprecated","version":"1.0.7","language":"javascript","source_language":"en","source_url":"https://github.com/jetiny/rollup-plugin-re","tags":["javascript","rollup-plugin","regexp","replace"],"install":[{"cmd":"npm install rollup-plugin-re","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-re","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-re","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: works as a Rollup plugin","package":"rollup","optional":false},{"reason":"Used for include/exclude pattern matching","package":"minimatch","optional":false}],"imports":[{"note":"This package uses a default export. Named import will be undefined.","wrong":"import { replace } from 'rollup-plugin-re'","symbol":"replace","correct":"import replace from 'rollup-plugin-re'"},{"note":"In CommonJS, require returns the module exports object; default export is at .default.","wrong":"const replace = require('rollup-plugin-re')","symbol":"replace","correct":"const replace = require('rollup-plugin-re').default"},{"note":"TypeScript types are included in the package. You can import the options interface for type safety.","wrong":null,"symbol":"types","correct":"import type { RollupPluginReOptions } from 'rollup-plugin-re'"}],"quickstart":{"code":"import { rollup } from 'rollup';\nimport replace from 'rollup-plugin-re';\n\nrollup({\n  input: 'src/main.js',\n  plugins: [\n    replace({\n      include: '**/*.js',\n      excludes: 'node_modules/**',\n      defines: {\n        DEBUG: false,\n      },\n      replaces: {\n        __VERSION__: '1.0.0',\n      },\n      patterns: [\n        {\n          test: /process\\.env\\.NODE_ENV/,\n          replace: '\"production\"',\n        },\n      ],\n    }),\n  ],\n  output: {\n    file: 'bundle.js',\n    format: 'cjs',\n  },\n}).then(() => console.log('done'));","lang":"typescript","description":"Basic Rollup setup using rollup-plugin-re for define macros, string replacements, and regex-based replacements."},"warnings":[{"fix":"Migrate to @rollup/plugin-replace for simple string replacements, or use rollup-plugin-string-replace for regex support.","message":"Package is no longer maintained. Use @rollup/plugin-replace or modern alternatives.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Use 'exclude' instead of 'excludes' in the plugin options object.","message":"The 'excludes' option is misspelled as 'excludes' in code examples, but actually 'exclude' is correct.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Avoid using 'match'; use 'include'/'exclude' for file filtering and 'test'/'replace' for content transformation.","message":"Patterns with 'match' property are not applied correctly; 'match' is intended for internal file matching but may cause confusion.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Return only the transformed code string from transform functions.","message":"The 'transform' function in a pattern must return a string; returning an object with 'code' and 'map' is not supported.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: import replace from 'rollup-plugin-re' (without curly braces).","cause":"Using named import instead of default import.","error":"TypeError: replace is not a function"},{"fix":"Run: npm install minimatch --save-dev","cause":"Missing dependency 'minimatch' (it is not a peer dependency but required at runtime).","error":"Error: Cannot find module 'minimatch'"},{"fix":"Change option name to 'exclude'.","cause":"Typo in option name: 'excludes' instead of 'exclude'.","error":"The 'excludes' option is not recognized. Did you mean 'exclude'?"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}