2022-01-08 17:20:46 +08:00
|
|
|
import vue from '@vitejs/plugin-vue'
|
2022-02-21 11:25:06 +08:00
|
|
|
|
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
|
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
|
2022-01-25 16:26:51 +08:00
|
|
|
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
|
2022-02-21 11:25:06 +08:00
|
|
|
|
2022-01-25 16:26:51 +08:00
|
|
|
import { unocss } from './unocss'
|
2022-01-08 17:20:46 +08:00
|
|
|
import { configHtmlPlugin } from './html'
|
|
|
|
import { configMockPlugin } from './mock'
|
|
|
|
|
|
|
|
export function createVitePlugins(viteEnv, isBuild) {
|
2022-02-21 11:25:06 +08:00
|
|
|
const plugins = [
|
|
|
|
vue(),
|
|
|
|
Components({
|
|
|
|
resolvers: [NaiveUiResolver()],
|
|
|
|
}),
|
|
|
|
VueSetupExtend(),
|
|
|
|
unocss(),
|
|
|
|
configHtmlPlugin(viteEnv, isBuild),
|
|
|
|
]
|
2022-01-08 17:20:46 +08:00
|
|
|
|
|
|
|
viteEnv?.VITE_APP_USE_MOCK && plugins.push(configMockPlugin(isBuild))
|
|
|
|
|
|
|
|
return plugins
|
|
|
|
}
|