34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import type { PluginOption } from 'vite';
|
|
import { configAutoImport } from './AutoImport';
|
|
import { configHtml } from './Html';
|
|
import { configImagemin } from './Imagemin';
|
|
import { configLegacy } from './Legacy';
|
|
import { configPages } from './Pages';
|
|
import { configReact } from './React';
|
|
import { configUnocss } from './Unocss';
|
|
|
|
export const loadPlugins = (env: ImportMetaEnv, isBuild: boolean) => {
|
|
/**
|
|
* vite 插件列表
|
|
* @description (!)代表必要插件,(?)代表可选插件,(*)代表推荐插件
|
|
*/
|
|
const vitePlugins: (PluginOption | PluginOption[])[] = [
|
|
// ! 原子化 css 引擎
|
|
configUnocss(),
|
|
// ! 用于 React 项目的一体化 Vite 插件
|
|
configReact(),
|
|
// ! 文件路由系统
|
|
configPages(),
|
|
// ! 自动导入 API
|
|
configAutoImport(),
|
|
// * 为 index.html 提供压缩和基于 ejs 模板功能的 vite 插件
|
|
configHtml(env, isBuild),
|
|
// ? 图片压缩插件
|
|
configImagemin(),
|
|
// ? 为支持传统浏览器的语言提供兼容性支持
|
|
configLegacy(),
|
|
];
|
|
|
|
return vitePlugins;
|
|
};
|