Registry / devops / rollup-plugin-rename

rollup-plugin-rename

JSON →
library1.0.1jsnpmunverified

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.

npm install rollup-plugin-rename
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-RENA
R
rollup-plugin-rename
devopsjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rename
import rename from '@betit/rollup-plugin-rename';
const rename = require('@betit/rollup-plugin-rename');
Package appears to be ESM-first; require may fail in certain bundler contexts.
IRenameExtensionsOptions
import type { IRenameExtensionsOptions } from '@betit/rollup-plugin-rename';
import { IRenameExtensionsOptions } from '@betit/rollup-plugin-rename';
Type export is not value export; use type import for TypeScript.
default (rename)
import rename from '@betit/rollup-plugin-rename';
import { rename } from '@betit/rollup-plugin-rename';
The package exports a default function, not a named export.

Rename source paths from src/ to dist/ when using preserveModules, with source maps and TypeScript types.

import rename from '@betit/rollup-plugin-rename'; import { defineConfig } from 'rollup'; export default defineConfig({ input: 'src/index.ts', preserveModules: true, output: { dir: 'dist', format: 'es', }, plugins: [ rename({ include: ['**/*.ts'], map: (name) => name.replace('src/', 'dist/'), sourceMap: true, }), ], });
Debug
Known issues
gotchaThe plugin does not apply to entry points; only internal module paths are renamed. Entry output filename remains unchanged.
fix
Manually rename entry file in output options or use additional plugin.
affects: <=1.0.1
gotchaThe 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.
fix
Ensure the map function handles all possible paths; use include to limit scope.
affects: <=1.0.1
deprecatedPackage is published under scoped name @betit/rollup-plugin-rename on npm. Legacy import path without @betit/ is no longer functional.
fix
Use import from '@betit/rollup-plugin-rename'; check package.json of your rollup config.
affects: >=0.0.1
gotchaIf 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.
fix
Use dedicated extension-rename plugin or handle extension logic in build script.
affects: <=1.0.1
gotchaThe plugin may not work correctly with non-JS loaders (e.g., images, CSS) that output chunks with non-standard import rewriting.
fix
Test with simple file types; open an issue for unsupported cases.
affects: <=1.0.1
Errors
Common errors & fixes
Error: Cannot find module '@betit/rollup-plugin-rename'
Import path without @betit/ scope or missing package install.
fix
npm install @betit/rollup-plugin-rename --save-dev && use import rename from '@betit/rollup-plugin-rename';
TypeError: rename is not a function
Wrong import style: { rename } instead of default import.
fix
import rename from '@betit/rollup-plugin-rename';
The plugin 'rename' is not a function or valid Rollup plugin.
Imported module is not the plugin itself, perhaps a re-export wrapper.
fix
Ensure you are importing the default export from '@betit/rollup-plugin-rename'.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
rollupoptionalPeer dependency; plugin works as a Rollup plugin.
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-rename — npm install rollup-plugin-rename · libregistry