Code Monkey home page Code Monkey logo

Comments (7)

allista avatar allista commented on May 30, 2024 4

Same here. For some reason it fails to chmod a copied file.

And for me it fails sporadically, without any pattern, which suggests a race condition.

I have "rollup-plugin-copy": "3.4.0"

from rollup-plugin-copy.

HanMoeHtet avatar HanMoeHtet commented on May 30, 2024 1

@gunnartorfis I just copied the source and tweaked a little. Just added try catch block Here

from rollup-plugin-copy.

gunnartorfis avatar gunnartorfis commented on May 30, 2024

Happening to me as well. Any ideas for a workaround?
In my case, I'm copying JSON localization files over to the dist folder after a build.

from rollup-plugin-copy.

DanielOrtel avatar DanielOrtel commented on May 30, 2024

are you by chance using del, or any plugin that cleans the output directory? I started seeing the error when I added that. One solution would be to ensure that copy runs after del, and that both use the same buildEnd hook:

    del({
      targets: ['./.dist', './public'],
      hook: 'buildEnd',
      runOnce: true
    }),
    copy({
      targets: [{ src: 'prebuilt/*', dest: 'public/' }],
      hook: 'writeBundle',
      copyOnce: true
    })

If that doesn't work, fork the package and add:

if (!fs.existsSync(path.dirname(dest))) {
    fs.mkdirSync(path.dirname(dest), { recursive: true });
}

before the copy, to ensure that the directory is created before attempting to copy it. Fyi, that should solve any issues with this package.

from rollup-plugin-copy.

vladshcherbin avatar vladshcherbin commented on May 30, 2024

Can someone provide a reproduction repo? I'll try to find the underlying reason 🙌

from rollup-plugin-copy.

DanielOrtel avatar DanielOrtel commented on May 30, 2024

I can provide one, though I'm currently using the fork I created(see the linked PR above), and I haven't seen this issue since.

Basically add this to any package's rollup config:

const del = require('rollup-plugin-delete');

export const config = {
    input: './index.js',
    output: {
      sourcemap: true,
      dir: './.dist',
      format: 'esm'
    },
      copy({
        targets: [{ src: 'prebuilt/*', dest: 'public/' }],
        copyOnce: true
      }),
      del({
        targets: ['./.dist', './public'],
        hook: 'buildEnd',
        runOnce: true
      })
}

And ensure there is something in the prebuilt folder to copy. I believe it should fail, because the folder does not exist, since the del hook removed it.

If you need a full repro, I can also provide a repo for that, though again, #71 fixes this issue for me.

from rollup-plugin-copy.

vladshcherbin avatar vladshcherbin commented on May 30, 2024

@DanielOrtel thank you, will try locally

from rollup-plugin-copy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.