1.0.0 • Published 2 years ago

vite-plugin-copying v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

vite-plugin-copying

A file copying plugin about vite

Install

npm install vite-plugin-copying -D

Configuration Item

options = {
    // When null, configure as serve and build
    apply: 'serve' | 'build' | null, 
    /*  File configuration that needs to be copied
     *  It can be an object or an array
     */
    copy: {
        // Location of files to be copied
        from: 'public',
        // Where do I need to copy to
        to: 'dist/public',
        // --------- optional ---------
        include: [],
        exclude: []
    }
}

Introduction to Usage

import VitePluginCopying from 'vite-plugin-copying'

export default defineConfig({
  plugins: [
    // ...
    // It should be noted that the plugin returns as an array, 
    // as it needs to be compatible with non passed in apply items
    // Therefore, it is necessary to use the extension operator of arrays
    ...VitePluginCopying({
      copy: {
        from: 'public',
        to: 'dist/public'
      }
    })
  ],
})