Nuxt/packages/vite/src/plugins/cache-dir.ts

14 lines
386 B
TypeScript
Raw Normal View History

import { resolve } from 'pathe'
import type { Plugin } from 'vite'
export function cacheDirPlugin (rootDir: string, name: string) {
const optimizeCacheDir = resolve(rootDir, 'node_modules/.cache/vite', name)
return <Plugin> {
name: 'nuxt:cache-dir',
configResolved (resolvedConfig) {
// @ts-ignore
resolvedConfig.optimizeCacheDir = optimizeCacheDir
}
}
}