{"id":22198,"library":"rollup-plugin-rename","title":"rollup-plugin-rename","description":"Rollup plugin that renames file paths before they are emitted, rewriting all imports and exports across the bundle to match the new names. Current version is 1.0.1, with a simple API: a map function transforms original file paths to new ones. Unlike other rename plugins, it supports include/exclude patterns and source map generation. Particularly useful when using preserveModules to restructure output directories. No ongoing maintenance activity observed since 2021.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/yesmeck/rollup-plugin-rename","tags":["javascript"],"install":[{"cmd":"npm install rollup-plugin-rename","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-rename","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-rename","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin works as a Rollup plugin.","package":"rollup","optional":true}],"imports":[{"note":"Package appears to be ESM-first; require may fail in certain bundler contexts.","wrong":"const rename = require('@betit/rollup-plugin-rename');","symbol":"rename","correct":"import rename from '@betit/rollup-plugin-rename';"},{"note":"Type export is not value export; use type import for TypeScript.","wrong":"import { IRenameExtensionsOptions } from '@betit/rollup-plugin-rename';","symbol":"IRenameExtensionsOptions","correct":"import type { IRenameExtensionsOptions } from '@betit/rollup-plugin-rename';"},{"note":"The package exports a default function, not a named export.","wrong":"import { rename } from '@betit/rollup-plugin-rename';","symbol":"default (rename)","correct":"import rename from '@betit/rollup-plugin-rename';"}],"quickstart":{"code":"import rename from '@betit/rollup-plugin-rename';\nimport { defineConfig } from 'rollup';\n\nexport default defineConfig({\n  input: 'src/index.ts',\n  preserveModules: true,\n  output: {\n    dir: 'dist',\n    format: 'es',\n  },\n  plugins: [\n    rename({\n      include: ['**/*.ts'],\n      map: (name) => name.replace('src/', 'dist/'),\n      sourceMap: true,\n    }),\n  ],\n});","lang":"typescript","description":"Rename source paths from src/ to dist/ when using preserveModules, with source maps and TypeScript types."},"warnings":[{"fix":"Manually rename entry file in output options or use additional plugin.","message":"The plugin does not apply to entry points; only internal module paths are renamed. Entry output filename remains unchanged.","severity":"gotcha","affected_versions":"<=1.0.1"},{"fix":"Ensure the map function handles all possible paths; use include to limit scope.","message":"The include option filters which files are eligible for renaming, but code that imports or exports those files will have import paths rewritten even if the importer is not in include.","severity":"gotcha","affected_versions":"<=1.0.1"},{"fix":"Use import from '@betit/rollup-plugin-rename'; check package.json of your rollup config.","message":"Package is published under scoped name @betit/rollup-plugin-rename on npm. Legacy import path without @betit/ is no longer functional.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Use dedicated extension-rename plugin or handle extension logic in build script.","message":"If you use the map function to change file extensions (e.g., .ts to .js), the plugin does not update the output file extension; it only renames the path string. Use rollup-plugin-rename-extensions for extension changes.","severity":"gotcha","affected_versions":"<=1.0.1"},{"fix":"Test with simple file types; open an issue for unsupported cases.","message":"The plugin may not work correctly with non-JS loaders (e.g., images, CSS) that output chunks with non-standard import rewriting.","severity":"gotcha","affected_versions":"<=1.0.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install @betit/rollup-plugin-rename --save-dev && use import rename from '@betit/rollup-plugin-rename';","cause":"Import path without @betit/ scope or missing package install.","error":"Error: Cannot find module '@betit/rollup-plugin-rename'"},{"fix":"import rename from '@betit/rollup-plugin-rename';","cause":"Wrong import style: { rename } instead of default import.","error":"TypeError: rename is not a function"},{"fix":"Ensure you are importing the default export from '@betit/rollup-plugin-rename'.","cause":"Imported module is not the plugin itself, perhaps a re-export wrapper.","error":"The plugin 'rename' is not a function or valid Rollup plugin."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}