123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { cdn } from "./cdn";
- import vue from "@vitejs/plugin-vue";
- import { pathResolve } from "./utils";
- import { viteBuildInfo } from "./info";
- import svgLoader from "vite-svg-loader";
- import type { PluginOption } from "vite";
- import vueJsx from "@vitejs/plugin-vue-jsx";
- import { configCompressPlugin } from "./compress";
- import removeNoMatch from "vite-plugin-router-warn";
- import { visualizer } from "rollup-plugin-visualizer";
- import removeConsole from "vite-plugin-remove-console";
- import { themePreprocessorPlugin } from "@pureadmin/theme";
- import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
- import { genScssMultipleScopeVars } from "../src/layout/theme";
- import { vitePluginFakeServer } from "vite-plugin-fake-server";
- export function getPluginsList(
- VITE_CDN: boolean,
- VITE_COMPRESSION: ViteCompression
- ): PluginOption[] {
- const lifecycle = process.env.npm_lifecycle_event;
- return [
- vue(),
-
- vueJsx(),
- VueI18nPlugin({
- runtimeOnly: true,
- compositionOnly: true,
- include: [pathResolve("../locales/**")]
- }),
- viteBuildInfo(),
-
- removeNoMatch(),
-
- vitePluginFakeServer({
- logger: false,
- include: "mock",
- infixName: false,
- enableProd: true
- }),
-
- themePreprocessorPlugin({
- scss: {
- multipleScopeVars: genScssMultipleScopeVars(),
- extract: true
- }
- }),
-
- svgLoader(),
- VITE_CDN ? cdn : null,
- configCompressPlugin(VITE_COMPRESSION),
-
- removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }),
-
- lifecycle === "report"
- ? visualizer({ open: true, brotliSize: true, filename: "report.html" })
- : (null as any)
- ];
- }
|