123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import Unocss from "unocss/vite";
- import vue from "@vitejs/plugin-vue";
- import { viteBuildInfo } from "./info";
- import svgLoader from "vite-svg-loader";
- import legacy from "@vitejs/plugin-legacy";
- import vueJsx from "@vitejs/plugin-vue-jsx";
- import { visualizer } from "rollup-plugin-visualizer";
- import removeConsole from "vite-plugin-remove-console";
- import themePreprocessorPlugin from "@pureadmin/theme";
- import { genScssMultipleScopeVars } from "../src/layout/theme";
- import DefineOptions from "unplugin-vue-define-options/vite";
- import OptimizationPersist from "vite-plugin-optimize-persist";
- import PkgConfig from "vite-plugin-package-config";
- export function getPluginsList(command, VITE_LEGACY) {
- const lifecycle = process.env.npm_lifecycle_event;
- return [
- vue(),
-
- vueJsx(),
- Unocss(),
- DefineOptions(),
-
- removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }),
- viteBuildInfo(),
-
- themePreprocessorPlugin({
- scss: {
- multipleScopeVars: genScssMultipleScopeVars(),
-
- extract: true,
-
- themeLinkTagId: "head",
-
- themeLinkTagInjectTo: "head",
-
- removeCssScopeName: false
- }
- }),
-
- svgLoader(),
-
- PkgConfig(),
- OptimizationPersist(),
-
- VITE_LEGACY
- ? legacy({
- targets: ["ie >= 11"],
- additionalLegacyPolyfills: ["regenerator-runtime/runtime"]
- })
- : null,
-
- lifecycle === "report"
- ? visualizer({ open: true, brotliSize: true, filename: "report.html" })
- : null
- ];
- }
|