sapphi-red / vite-plugin-static-copy

rollup-plugin-copy with dev server support.
MIT License
299 stars 32 forks source link

Sporadic writeBundle errors #130

Closed klaemo closed 4 days ago

klaemo commented 1 month ago

Hey there, I'm copying a bunch of files in my outDir and keep getting sporadic errors. They are rather random, so I don't know how to reproduce them. Looks like a race condition maybe?

Here are the relevant parts of my vite config:

{
    publicDir: './src/assets/_global',
    plugins: [viteStaticCopy({ targets: [{ src: `./src/assets/${publication}/*`, dest: './' }] })],
    build: {
      outDir: `./dist/${publication}`,
    }
}

Example errors:

[[vite-plugin-static-copy:build] ENOENT: no such file or directory, chmod '/Users/clemens.stolle/dev/thing/packages/templates/dist/xxxxx/fallbacks/image-fallback-default.png'
Error: ENOENT: no such file or directory, chmod '/Users/clemens.stolle/dev/thing/packages/templates/dist/xxxxx/fallbacks/image-fallback-default.png'] {
  errno: -2,
  code: 'PLUGIN_ERROR',
  syscall: 'chmod',
  path: '/Users/clemens.stolle/dev/thing/packages/templates/dist/xxxxx/fallbacks/image-fallback-default.png',
  pluginCode: 'ENOENT',
  plugin: 'vite-plugin-static-copy:build',
  hook: 'writeBundle'
}
[[vite-plugin-static-copy:build] EEXIST: file already exists, mkdir '/Users/clemens.stolle/dev/thing/packages/templates/dist/xxxxx/fallbacks'
Error: EEXIST: file already exists, mkdir '/Users/clemens.stolle/dev/thing/packages/templates/dist/xxxxx/fallbacks'] {
  errno: -17,
  code: 'PLUGIN_ERROR',
  syscall: 'mkdir',
  path: '/Users/clemens.stolle/dev/thing/packages/templates/dist/xxxxx/fallbacks',
  pluginCode: 'EEXIST',
  plugin: 'vite-plugin-static-copy:build',
  hook: 'writeBundle'
}
Node.js v20.18.0
vite: 5.4.9
vite-plugin-static-copy: 2.0.0
sapphi-red commented 1 month ago

I need a reproduction to check this.

sapphi-red commented 4 days ago

Closing due to lack of response.