| | |
| | | /* |
| | | * @Description: file content |
| | | * @Author: Ben Lin |
| | | * @version: |
| | | * @Date: 2024-06-18 21:50:22 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-18 23:44:19 |
| | | */ |
| | | import vue from '@vitejs/plugin-vue'; |
| | | import vueJsx from '@vitejs/plugin-vue-jsx'; |
| | | // @ts-ignore: type unless |
| | | import DefineOptions from 'unplugin-vue-define-options/vite'; |
| | | import { type PluginOption } from 'vite'; |
| | | import purgeIcons from 'vite-plugin-purge-icons'; |
| | | import DevTools from 'vite-plugin-vue-devtools'; |
| | | |
| | | import { createAppConfigPlugin } from './appConfig'; |
| | | import { configCompressPlugin } from './compress'; |
| | |
| | | import { configMockPlugin } from './mock'; |
| | | import { configSvgIconsPlugin } from './svgSprite'; |
| | | import { configVisualizerConfig } from './visualizer'; |
| | | import vueSetupExtend from 'vite-plugin-vue-setup-extend'; |
| | | |
| | | interface Options { |
| | | isBuild: boolean; |
| | | root: string; |
| | |
| | | } |
| | | |
| | | async function createPlugins({ isBuild, root, enableMock, compress, enableAnalyze }: Options) { |
| | | const vitePlugins: (PluginOption | PluginOption[])[] = [ |
| | | vue(), |
| | | vueJsx(), |
| | | vueSetupExtend(), |
| | | DefineOptions(), |
| | | ]; |
| | | const vitePlugins: (PluginOption | PluginOption[])[] = [vue(), vueJsx()]; |
| | | |
| | | const appConfigPlugin = await createAppConfigPlugin({ root, isBuild }); |
| | | vitePlugins.push(appConfigPlugin); |
| | | |
| | | // vitePlugins.push(DevTools()); |
| | | |
| | | // vite-plugin-html |
| | | vitePlugins.push(configHtmlPlugin({ isBuild })); |
| | | |