1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import type { Plugin } from 'vite'
- import Components from 'unplugin-vue-components/vite'
- import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
- import vueSetupExtend from 'vite-plugin-vue-setup-extend'
- import vue from '@vitejs/plugin-vue'
- import vueJsx from '@vitejs/plugin-vue-jsx'
- import { configHtmlPlugin } from './html'
- import { configCompressPlugin } from './compress'
- export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean, prodMock) {
- const { VITE_USE_MOCK, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE } = viteEnv
- const vitePlugins: (Plugin | Plugin[])[] = [
-
- vue(),
-
- vueJsx(),
-
- Components({
- dts: true,
- resolvers: [NaiveUiResolver()]
- })
- ]
-
- vitePlugins.push(configHtmlPlugin(viteEnv, isBuild))
-
- vitePlugins.push(vueSetupExtend())
-
-
- if (isBuild) {
-
- vitePlugins.push(
- configCompressPlugin(VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE)
- )
- }
- return vitePlugins
- }
|