Description
In a monorepo using relative ../../ paths to copy files from sibling packages, v4 produces incorrect output paths.
viteStaticCopy({
targets: [
{ src: '../../packages/ui/locales/*', dest: 'locales' },
],
})
Expected: dist/locales/en/ui.json
v3.4.0: Correct
v4.0.0: dist/locales/packages/ui/locales/en/ui.json
The ../../ prefix is stripped by dir.replace(/^(?:\.\.\/)+/, ''), but the remaining packages/ui/locales/en structure gets preserved under dest.
rename: { stripBase: true } over-corrects and places files at dist/ui.json. rename: { stripBase: N } with various values doesn't produce the correct result either.
Workaround: Pin to v3.4.0 (which supports Vite 8).
- vite-plugin-static-copy: 4.0.0
- vite: 8.x
- pnpm workspaces
Description
In a monorepo using relative
../../paths to copy files from sibling packages, v4 produces incorrect output paths.Expected:
dist/locales/en/ui.jsonv3.4.0: Correct
v4.0.0:
dist/locales/packages/ui/locales/en/ui.jsonThe
../../prefix is stripped bydir.replace(/^(?:\.\.\/)+/, ''), but the remainingpackages/ui/locales/enstructure gets preserved underdest.rename: { stripBase: true }over-corrects and places files atdist/ui.json.rename: { stripBase: N }with various values doesn't produce the correct result either.Workaround: Pin to v3.4.0 (which supports Vite 8).