mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-10-12 04:43:42 +08:00
refactor(projects): 代码优化
This commit is contained in:
@@ -1,28 +1,26 @@
|
||||
import type { ConfigEnv, PluginOption } from 'vite';
|
||||
import type { PluginOption } from 'vite';
|
||||
import vue from './vue';
|
||||
import vueJsx from './jsx';
|
||||
import html from './html';
|
||||
import autoImport from './auto-import';
|
||||
import unplugin from './unplugin';
|
||||
import unocss from './unocss';
|
||||
import mock from './mock';
|
||||
import visualizer from './visualizer';
|
||||
import compress from './compress';
|
||||
|
||||
/**
|
||||
* vite插件
|
||||
* @param configEnv - 环境
|
||||
* @param srcPath - src路径
|
||||
* @param viteEnv - 环境变量配置
|
||||
* @param srcPath - src路径
|
||||
*/
|
||||
export function setupVitePlugins(
|
||||
configEnv: ConfigEnv,
|
||||
srcPath: string,
|
||||
viteEnv: ImportMetaEnv
|
||||
): (PluginOption | PluginOption[])[] {
|
||||
const plugins = [vue, vueJsx, html(configEnv), ...autoImport(srcPath), unocss, mock];
|
||||
export function setupVitePlugins(viteEnv: ImportMetaEnv, srcPath: string): (PluginOption | PluginOption[])[] {
|
||||
const plugins = [...vue, html(viteEnv), ...unplugin(srcPath), unocss, mock];
|
||||
|
||||
if (configEnv.command === 'build' && viteEnv.VITE_VISUALIZER === 'true') {
|
||||
if (viteEnv.VITE_VISUALIZER === 'true') {
|
||||
plugins.push(visualizer);
|
||||
}
|
||||
if (viteEnv.VITE_COMPRESS === 'true') {
|
||||
plugins.push(compress(viteEnv));
|
||||
}
|
||||
|
||||
return plugins;
|
||||
}
|
||||
|
Reference in New Issue
Block a user