Skip to content

Latest commit

 

History

History
229 lines (123 loc) · 14.9 KB

File metadata and controls

229 lines (123 loc) · 14.9 KB

vite-plugin-static-copy

4.1.0

Minor Changes

  • #251 7672842 Thanks @sapphi-red! - Add name property to the rename object form and allow rename functions to return a RenameObject. The name property replaces the file's basename (filename + extension), and can be combined with stripBase to both flatten directory structure and rename the file in one step. Rename functions can now return { name, stripBase } objects instead of only strings, making it easier to declaratively control output paths from dynamic rename logic.

    // node_modules/lib/dist/index.js → vendor/lib.js
    { src: 'node_modules/lib/dist/index.js', dest: 'vendor', rename: { name: 'lib.js', stripBase: true } }
    
    // src/pages/events/test.html → dist/events/index.html
    { src: 'src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2, name: 'index.html' } }

4.0.1

Patch Changes

  • #249 c6bf44c Thanks @sapphi-red! - Fix absolute dest paths being nested under the output directory

    When dest was an absolute path and the source file had a directory component (structured output), the path was incorrectly converted to a relative path, causing files to be nested under the build output directory instead of being copied to the specified absolute path.

    { src: 'foo/foo.txt', dest: '/home/user/my-repo/bar' }

    Before: /home/user/my-repo/dist/home/user/my-repo/bar/foo/foo.txt After: /home/user/my-repo/bar/foo/foo.txt

  • #247 d3af79e Thanks @sapphi-red! - Fix rename.stripBase to work correctly with ../ paths

    Previously, stripBase counted .. as directory segments, causing incorrect output paths when copying from parent directories.

    { src: '../../src/pages/**/*.html', dest: 'dist/', rename: { stripBase: 2 } }

    Before: dist/src/pages/events/test.html After: dist/events/test.html

    { src: '../../src/pages/**/*.html', dest: 'dist/', rename: { stripBase: true } }

    Before: dist/src/pages/events/test.html After: dist/test.html

4.0.0

Major Changes

  • #235 b2edc86 Thanks @sapphi-red! - Simplify glob behavior and always preserve directory structure.

    Breaking changes:

    • Only files are matched. Glob patterns no longer match directory entries. Previously, matching a directory would recursively copy it via fs.cp, which caused files to be copied twice when using ** patterns.
    • Directory patterns are auto-expanded. src: 'assets' now automatically expands to match all files inside the directory, using tinyglobby's built-in expandDirectories option. No migration needed for this pattern alone.
    • structured option removed. Directory structure is now always preserved in the output. The structured option has been removed entirely. Use rename: { stripBase: true } to flatten output paths when needed.
  • #237 6129008 Thanks @sapphi-red! - Drop support for Vite 5

  • #238 9766e42 Thanks @sapphi-red! - Drop support for Node 18, 20, 21, 23. The new support range is ^22.0.0 || >= 24.0.0.

3.4.0

Minor Changes

  • #233 f665a15 Thanks @sapphi-red! - Add { stripBase: number } object form to the rename option. This strips the given number of leading directory segments from the matched path, avoiding the need for manual ../ traversals in a rename function.

    This is useful when copying files from deep paths like node_modules/my-lib/dist/**/* with structured: true, where the full directory structure would otherwise be preserved in the output. Instead of writing a rename function that manually returns ../ traversals to flatten unwanted nesting, you can use rename: { stripBase: N } to declaratively strip the leading segments.

3.3.0

Minor Changes

3.2.0

Minor Changes

  • #219 fbb2a7a Thanks @sapphi-red! - Add environment option to configure which environment the plugin runs in. Defaults to 'client'.

3.1.6

Patch Changes

3.1.5

Patch Changes

3.1.4

Patch Changes

  • #204 d0b5370 Thanks @stianjensen! - Removed fs-extra dependency in favor of node:fs. This should not affect the behavior.

3.1.3

Patch Changes

3.1.2

Patch Changes

3.1.1

Patch Changes

  • #186 fc84156 Thanks @sapphi-red! - fix a bug that the content was not sent when multiple vite-plugin-static-copy instance was used

3.1.0

Minor Changes

3.0.2

Patch Changes

3.0.1

Patch Changes

  • #166 60409c5 Thanks @sapphi-red! - fix absolute destination paths in copy targets incorrectly returning contents in dev

  • #164 337f976 Thanks @sapphi-red! - fixes case-insensitive path conflicts causing copy failures (EEXIST error)

3.0.0

Major Changes

2.3.1

Patch Changes

2.3.0

Minor Changes

  • 281f5b2 Thanks @sapphi-red! - improve performance by coping files concurrently when possible

Patch Changes

2.2.0

Minor Changes

2.1.0

Minor Changes

  • #133 b9c09bd Thanks @rschristian! - Allows user to optionally configure when the plugin is ran by passing in a Rollup hook name

2.0.0

Major Changes

1.0.6

Patch Changes

  • #121 d68aec9 Thanks @tobz1000! - The value of Content-Type header was inferred and set from the src file extension. It is now infered from the dest file extension.

1.0.5

Patch Changes

1.0.4

Patch Changes

1.0.3

Patch Changes

1.0.2

Patch Changes

1.0.1

Patch Changes

  • #79 19b9fca Thanks @sapphi-red! - using absolute path src with structured: true was not working. The fullPath argument in the rename option will now always be an absolute path, instead of sometimes being a relative path.

1.0.0

Major Changes

Patch Changes