12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import { cdn } from "./cdn";
- import vue from "@vitejs/plugin-vue";
- 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 { codeInspectorPlugin } from "code-inspector-plugin";
- 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(),
-
- codeInspectorPlugin({
- bundler: "vite",
- hideConsole: true
- }),
- viteBuildInfo(),
-
- removeNoMatch(),
-
- vitePluginFakeServer({
- logger: false,
- include: "mock",
- infixName: false,
- enableProd: 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)
- ];
- }
|