npm / vite-plugin-static-copy
vite-plugin-static-copy
What changed in vite-plugin-static-copy 3 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
5 breaking4 new APIs and options2 behavior and defaults1 tooling4 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initvite-plugin-static-copy 411 changes
Breaking changes 4
Glob patterns now match only files, not directory entries; matching directories no longer recursively copy their contents.
Node 18, 20, 21, and 23 are no longer supported; the new support range is
^22.0.0 || >= 24.0.0.The
structuredoption has been removed; userename: { stripBase: true }to flatten output paths when needed.Support for Vite 5 has been dropped.
New APIs and options 2
Rename functions can return a RenameObject containing name and stripBase, instead of being limited to strings, making dynamic output paths easier to control declaratively.
The rename object form accepts name to replace the file's basename; it can be combined with stripBase to flatten directories and rename in one step.
Behavior and default changes 2
Directory structure is now always preserved in the output.
Directory patterns such as
src: 'assets'now automatically expand to match all files inside the directory.
Fixes and other changes 3
Static assets are copied using each environment's resolved build.outDir, preventing files from going to the wrong folder in multi-environment setups.
Absolute dest paths are no longer converted to relative paths when the source has a directory component, so files are copied to the specified absolute path.
stripBase now handles ../ paths correctly instead of counting .. as directory segments and producing incorrect output paths.
vite-plugin-static-copy 35 changes
Breaking changes 1
Copying now occurs only for the client environment.
New APIs and options 2
The rename option accepts an object with stripBase to remove a specified number of leading directory segments from the matched path.
Adds an option to configure which environment the plugin runs in; defaults to 'client'.
Tooling 1
Vite 8 is added to the peer dependency range, allowing projects using Vite 8 to use the plugin.
Fixes and other changes 1
Non-client environments are skipped only when multiple environments exist.