{"id":22139,"library":"rollup-plugin-mv","title":"rollup-plugin-mv","description":"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.","status":"active","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/Lazyuki/rollup-plugin-mv","tags":["javascript","rollup","plugin","rollup-plugin","mv","move","typescript"],"install":[{"cmd":"npm install rollup-plugin-mv","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-mv","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-mv","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default ESM import only. No named export exists.","wrong":"const { mv } = require('rollup-plugin-mv')","symbol":"mv","correct":"import mv from 'rollup-plugin-mv'"},{"note":"The package ships TypeScript types, but in CJS you must use require().default or dynamic import().","wrong":"const mv = require('rollup-plugin-mv').default","symbol":"mv","correct":"import mv from 'rollup-plugin-mv'"},{"note":"MoveConfig is a type-only export. Use import type to avoid runtime errors when using value imports.","wrong":"import { MoveConfig } from 'rollup-plugin-mv'","symbol":"type MoveConfig","correct":"import type { MoveConfig } from 'rollup-plugin-mv'"}],"quickstart":{"code":"// rollup.config.js\nimport mv from 'rollup-plugin-mv';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'cjs',\n  },\n  plugins: [\n    mv([\n      { src: 'dist/file.js', dest: 'dist/assets/file.js' },\n      { src: 'dist/folder', dest: 'dist/assets/folder', overwrite: true },\n    ], {\n      overwrite: false,\n      once: false,\n    }),\n  ],\n};","lang":"typescript","description":"Minimal Rollup configuration using rollup-plugin-mv to move files after build."},"warnings":[{"fix":"Use cross-device-aware tools or ensure source and destination are on the same filesystem.","message":"The plugin uses synchronous fs.renameSync under the hood, which fails if source and destination are on different filesystems (e.g., across drives on Windows).","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use 'once: true' only when generating multiple outputs from a single config. For multiple plugin instances, consider using a flag or manual check.","message":"The '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.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Explicitly set overwrite: true or manually remove the destination before running Rollup.","message":"If the destination file or directory already exists and overwrite is false, the move silently fails (no error thrown).","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"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.","cause":"Source file does not exist at the time the plugin runs (e.g., output generation order issue).","error":"Error: ENOENT: no such file or directory, rename 'dist/file' -> 'dist/assets/file'"},{"fix":"Use default import: import mv from 'rollup-plugin-mv'","cause":"Using a named import (import { mv } from ...) when the package only exports a default function.","error":"TypeError: mv is not a function"},{"fix":"Ensure each move entry has both 'src' and 'dest' strings: { src: '...', dest: '...' }","cause":"Passing an array with an object that lacks 'src' or 'dest' property.","error":"Error: src and dest are required"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}