{"library":"rollup-plugin-path-rewrite","title":"rollup-plugin-path-rewrite","description":"A Rollup plugin for rewriting output file or directory paths, primarily used with Rollup's preserveModules mode in ES module builds. Version 1.0.2 (latest, stable) supports Rollup versions 1.x through 4.x via peer dependencies and ships TypeScript definitions. Unlike generic file transformers, it focuses on post-build path manipulation, allowing regex-based path matching and string/function-based replacements. Ideal for reorganizing declaration files or assets in module-preserving output.","language":"javascript","status":"active","last_verified":"Mon Apr 27","install":{"commands":["npm install rollup-plugin-path-rewrite"],"cli":null},"imports":["import pathRewrite from 'rollup-plugin-path-rewrite'","const pathRewrite = require('rollup-plugin-path-rewrite')","import type { RollupPluginPathRewriteOptions } from 'rollup-plugin-path-rewrite'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// rollup.config.js\nimport pathRewrite from 'rollup-plugin-path-rewrite';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'es',\n    preserveModules: true,\n  },\n  plugins: [\n    pathRewrite({\n      test: /\\.d\\.ts$/i,\n      replaceTo: (path) => `types/${path}`,\n    }),\n  ],\n};","lang":"javascript","description":"Minimal rollup config using pathRewrite to move .d.ts files into a types/ subdirectory while preserving modules.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}