vladshcherbin / rollup-plugin-copy

Copy files and folders using Rollup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when copying multiple directories to the same nonexistent directory

golopot opened this issue · comments

Related issue #7 #9 .

Running rollup with the following config produces this error:

index.js → dist/bundle.js...
[!] (copy plugin) Error: EEXIST: file already exists, mkdir 'dist'
Error: EEXIST: file already exists, mkdir 'dist'
{
  "rollup": "^1.11.2",
  "rollup-plugin-copy": "^2.0.0"
}
import copy from "rollup-plugin-copy";
export default {
  input: "index.js",
  output: {
    file: "dist/bundle.js",
    format: "cjs"
  },
  plugins: [
    copy({
      targets: {
        "dir-1": "dist",
        "dir-2": "dist"
      }
    })
  ]
};

Edit:
Only happens when dist/ does not exist.

@golopot this happens because you target same directory, the plugin copies in parallel and both processes try to create same directory if it doesn't exist.

In your example you want files from dir-1 and dir-2 to be in dist folder, right?

I can make sequential copying to prevent this error 🤔

Released in 2.0.1. Check, if it works for you and thanks for the bug report 😉