Registry / devops / rollup-plugin-mv

rollup-plugin-mv

JSON →
library0.0.2jsnpmunverified

A Rollup plugin to move generated files and directories after the bundle is written. Version 0.0.2 is the current stable release; the plugin is minimal and has no updates yet. It provides a simple API to specify source and destination paths with optional overwrite and once flags. Compared to alternatives like rollup-plugin-copy or rollup-plugin-sh, it focuses exclusively on moving (not copying) and supports both files and directories. Includes TypeScript declarations.

npm install rollup-plugin-mv
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-MV
R
rollup-plugin-mv
devopsjavascriptv0.0.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

mv
✓ import mv from 'rollup-plugin-mv'
✗ const { mv } = require('rollup-plugin-mv')
Default ESM import only. No named export exists.
mv
✓ import mv from 'rollup-plugin-mv'
✗ const mv = require('rollup-plugin-mv').default
The package ships TypeScript types, but in CJS you must use require().default or dynamic import().
type MoveConfig
✓ import type { MoveConfig } from 'rollup-plugin-mv'
✗ import { MoveConfig } from 'rollup-plugin-mv'
MoveConfig is a type-only export. Use import type to avoid runtime errors when using value imports.

Minimal Rollup configuration using rollup-plugin-mv to move files after build.

// rollup.config.js import mv from 'rollup-plugin-mv'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'cjs', }, plugins: [ mv([ { src: 'dist/file.js', dest: 'dist/assets/file.js' }, { src: 'dist/folder', dest: 'dist/assets/folder', overwrite: true }, ], { overwrite: false, once: false, }), ], };
Debug
Known issues
gotchaThe plugin uses synchronous fs.renameSync under the hood, which fails if source and destination are on different filesystems (e.g., across drives on Windows).
fix
Use cross-device-aware tools or ensure source and destination are on the same filesystem.
affects: >=0.0.1
gotchaThe 'once' option only works when there are multiple outputs in the Rollup config. It does not prevent multiple moves if the plugin is included multiple times.
fix
Use 'once: true' only when generating multiple outputs from a single config. For multiple plugin instances, consider using a flag or manual check.
affects: >=0.0.1
gotchaIf the destination file or directory already exists and overwrite is false, the move silently fails (no error thrown).
fix
Explicitly set overwrite: true or manually remove the destination before running Rollup.
affects: >=0.0.1
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, rename 'dist/file' -> 'dist/assets/file'
Source file does not exist at the time the plugin runs (e.g., output generation order issue).
fix
Ensure the source is generated before the plugin executes, or use a hook like 'writeBundle' (the plugin already uses 'generateBundle'). Check if the file path is correct.
TypeError: mv is not a function
Using a named import (import { mv } from ...) when the package only exports a default function.
fix
Use default import: import mv from 'rollup-plugin-mv'
Error: src and dest are required
Passing an array with an object that lacks 'src' or 'dest' property.
fix
Ensure each move entry has both 'src' and 'dest' strings: { src: '...', dest: '...' }
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-mv — npm install rollup-plugin-mv · libregistry