1.0.3 • Published 8 months ago

vite-plugin-clean-pattern v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

vite-plugin-clean-pattern

npm

A vite plugin to remove/clean your build folder(s) using regex patterns to match specific files.

Credit

Credit to flyfox (https://github.com/flyfox11) for their work on vite-plugin-cleaner (https://github.com/z-ti/vite-plugin-clean/tree/main) which this plugin is based on.

Table of Contents

Installation

  bun i --dev vite-plugin-clean-pattern
  npm i --save-dev vite-plugin-clean-pattern
  yarn add --dev vite-plugin-clean-pattern

Usage

Here's an example vite config illustrating how to use this plugin

vite.config.js

import cleanPlugin from 'vite-plugin-clean-pattern';
export default {
  plugins: [cleanPlugin()],
}

You can pass a hash of configuration options to vite-plugin-clean-pattern. Allowed values are as follows:

NameTypeDefaultDescription
targetFiles{Array.<string>}['dist']List of directories removed before packing the file

Here's an example vite config illustrating how to use these options

vite.config.js

import cleanPlugin from 'vite-plugin-clean-pattern';
export default {
  plugins: [cleanPlugin(
    {
      targetFiles: [{ dirPath: 'dist', fileMatchPattern: '^vite_.*_[0-9a-z]{8}' }, ...]
    }
  )],
}

Issues

If you encounter some problems during use, please click here Issue Report

License

MIT

Copyright (c) 2023-present Jason Hassold