From e1c28921470ca2a82403ef5a7bc07f1c48619b36 Mon Sep 17 00:00:00 2001
From: 刘嘉威 <daidaibg@163.com>
Date: 星期三, 26 十月 2022 16:51:43 +0800
Subject: [PATCH] feat: 增加右上 右中图表

---
 vite.config.ts |  104 ++++++++++++++++++++++++----------------------------
 1 files changed, 48 insertions(+), 56 deletions(-)

diff --git a/vite.config.ts b/vite.config.ts
index 1b4e0a9..53566d5 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,65 +1,57 @@
-import path from "path";
-import { defineConfig } from "vite";
-import vue from "@vitejs/plugin-vue";
-import Components from "unplugin-vue-components/vite";
-import AutoImport from "unplugin-auto-import/vite";
 
-// https://vitejs.dev/config/
-export default defineConfig({
-  server: {
-    host: "localhost",
-    port: 8888,
-    open: true,
-    https: false,
-    proxy: {},
-  },
-  plugins: [
-    vue({
-      // https://vuejs.org/guide/extras/reactivity-transform.html
-      // 寮�鍚搷搴旀�ц娉曠硸 锛堣瘯楠屾�х壒鎬э級
-      // Reactivity Transform
-      reactivityTransform: true,
-    }),
+import type { UserConfig, ConfigEnv } from 'vite';
+import { defineConfig } from 'vite'
+import vue from '@vitejs/plugin-vue'
+import { resolve } from "path";
+import AutoImport from 'unplugin-auto-import/vite'
+import Components from 'unplugin-vue-components/vite'
+import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
+//https://github.com/element-plus/unplugin-element-plus/blob/HEAD/README.zh-CN.md
+import ElementPlus from 'unplugin-element-plus/vite'
+export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => {
 
-    // https://github.com/antfu/unplugin-auto-import
+  // const env = loadEnv(mode, process.cwd(), '')
+  console.log(command, mode);
+  return {
+    plugins: [vue(),
     AutoImport({
-      imports: [
-        "vue",
-        "vue-router",
-        "vue-i18n",
-        "vue/macros",
-        "@vueuse/head",
-        "@vueuse/core",
-      ],
-      dts: "types/auto-imports.d.ts",
-      dirs: [
-        "src/composables",
-        "src/store",
-      ],
-      vueTemplate: true,
+      resolvers: [ElementPlusResolver()],
     }),
-
-    // https://github.com/antfu/unplugin-vue-components
     Components({
-      extensions: ["vue"],
-      include: [/\.vue$/, /\.vue\?vue/],
-      dts: "types/components.d.ts",
-      exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
+      resolvers: [ElementPlusResolver()],
     }),
-  ],
-  resolve: {
-    alias: {
-      "~/": `${path.resolve(__dirname, "src")}/`,
+    ElementPlus({
+      // useSource: true
+    })
+    ],
+    publicDir: "public",
+    base: "./",
+    server: {
+      host: '0.0.0.0',
+      port: 8112,
+      open: false,
+      strictPort: false,
+      // proxy: {}
     },
-  },
-  css: {
-    preprocessorOptions: {
-      scss: {
-        additionalData: `
-      @import "~/styles/variables.scss";
-    `,
-        javascriptEnabled: true,
+    resolve: {
+      alias: {
+        "@": resolve(__dirname, "./src"),
+        "components": resolve(__dirname, "./src/components"),
+        "api": resolve(__dirname, "./src/api"),
       },
     },
-  },
-});
+    css: {
+      // css棰勫鐞嗗櫒
+      preprocessorOptions: {
+        scss: {
+          // charset: false,
+          additionalData: `@use "./src/assets/css/variable.scss" as *;`,
+        },
+      },
+    },
+    build: {
+      outDir: 'dist',
+    },
+  }
+
+})
\ No newline at end of file

--
Gitblit v1.8.0