You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
796 B
35 lines
796 B
import vue from '@vitejs/plugin-vue'
|
|
|
|
/**
|
|
* * unocss插件,原子css
|
|
* https://github.com/antfu/unocss
|
|
*/
|
|
import Unocss from 'unocss/vite'
|
|
|
|
// rollup打包分析插件
|
|
import visualizer from 'rollup-plugin-visualizer'
|
|
// 压缩
|
|
import viteCompression from 'vite-plugin-compression'
|
|
|
|
import { configHtmlPlugin } from './html'
|
|
import unplugin from './unplugin'
|
|
|
|
export function createVitePlugins(viteEnv, isBuild) {
|
|
const plugins = [vue(), ...unplugin, configHtmlPlugin(viteEnv, isBuild), Unocss()]
|
|
|
|
if (viteEnv.VITE_USE_COMPRESS) {
|
|
plugins.push(viteCompression({ algorithm: viteEnv.VITE_COMPRESS_TYPE || 'gzip' }))
|
|
}
|
|
|
|
if (isBuild) {
|
|
plugins.push(
|
|
visualizer({
|
|
open: true,
|
|
gzipSize: true,
|
|
brotliSize: true,
|
|
}),
|
|
)
|
|
}
|
|
|
|
return plugins
|
|
}
|
|
|