1.0.0-beta.1 • Published 1 year ago

@godf/vite-file-cache-plugin v1.0.0-beta.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Vite file cache plugin

  • Applicable to single files with long compilation time and low change frequenc.
  • Such as global sass and less file, or component.
  • Support hmr do not restart.

Install

npm install @godf/vite-file-cache-plugin --save-dev

Usage

vite.config.ts

import fileCahcePlugin from 'vite-file-cache-plugin'
export default defineConfig({
  plugins: [
    vue(),
    fileCahcePlugin({
      matchFn: (id) => id.includes('/src/styles/index.less')
    })
  ]
})

Options

functiondescriptioncallback parameter
matchFnassess whether to cache file(id?: string) id: vite module id