JSPM

vite-plugin-preserve-files

0.1.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q36756F
    • License MIT

    A Vite plugin to preserve specified files to the build directory

    Package Exports

    • vite-plugin-preserve-files
    • vite-plugin-preserve-files/dist/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vite-plugin-preserve-files) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Vite Plugin preserve Files

    A Vite plugin to preserve specified files to the build directory while maintaining their original paths.

    Installation

    npm install vite-plugin-preserve-files --save-dev

    Usage

    Vite Configuration

    Add the plugin to your vite.config.ts:

    import { defineConfig } from 'vite';
    import preserveFilesPlugin from 'vite-plugin-preserve-files';
    
    export default defineConfig({
      plugins: [
        preserveFilesPlugin({
          fileTypes: [], // Add any file extensions you want to preserve
          include: [],                  // Optional: include specific paths
          exclude: []                   // Optional: exclude specific paths
        })
      ]
    });

    Options

    • fileTypes (optional): An array of file extensions to preserve. Defaults to [].
    • include (optional): An array of paths to include. If empty, all paths are included. Defaults to [].
    • exclude (optional): An array of paths to exclude. Defaults to [].

    Example

    import { defineConfig } from 'vite';
    import preserveFilesPlugin from 'vite-plugin-preserve-files';
    
    export default defineConfig({
      plugins: [
        preserveFilesPlugin({
          fileTypes: ['.yaml', '.yml', '.json'],
          include: ['src/config'],
          exclude: ['src/config/temp']
        })
      ]
    });

    License

    MIT License. See LICENSE for details.