vite-plugin-static-copy
vite-plugin-static-copy copied to clipboard
Sporadic writeBundle errors
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