1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { cdn } from "./cdn";
- import vue from "@vitejs/plugin-vue";
- import { viteBuildInfo } from "./info";
- import svgLoader from "vite-svg-loader";
- import vueJsx from "@vitejs/plugin-vue-jsx";
- import { configCompressPlugin } from "./compress";
- // import ElementPlus from "unplugin-element-plus/vite";
- import { visualizer } from "rollup-plugin-visualizer";
- import removeConsole from "vite-plugin-remove-console";
- import Components from "unplugin-vue-components/vite";
- import { VantResolver } from "@vant/auto-import-resolver";
- export function getPluginsList(
- command: string,
- VITE_CDN: boolean,
- VITE_COMPRESSION: ViteCompression
- ) {
- const prodMock = true;
- const lifecycle = process.env.npm_lifecycle_event;
- return [
- vue(),
- // jsx、tsx语法支持
- vueJsx(),
- Components({
- resolvers: [VantResolver()],
- }),
- VITE_CDN ? cdn : null,
- configCompressPlugin(VITE_COMPRESSION),
- // 线上环境删除console
- // removeConsole({ external: ["src/assets/iconfont/iconfont.js"] }),
- viteBuildInfo(),
- // svg组件化支持
- svgLoader(),
- // ElementPlus({}),
- // 打包分析
- lifecycle === "report"
- ? visualizer({ open: true, brotliSize: true, filename: "report.html" })
- : null,
- ];
- }
|