From c999abb236de8964c53c652fd8b7233cb775810d Mon Sep 17 00:00:00 2001
From: jinmao88 <50581550+jinmao88@users.noreply.github.com>
Date: 星期一, 30 一月 2023 16:20:54 +0800
Subject: [PATCH] fix: ci error

---
 vite.config.ts |   44 +++++++++++++++++++++++++++-----------------
 1 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/vite.config.ts b/vite.config.ts
index e60367f..8f5f444 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,16 +1,13 @@
 import type { UserConfig, ConfigEnv } from 'vite';
-
+import pkg from './package.json';
+import dayjs from 'dayjs';
 import { loadEnv } from 'vite';
 import { resolve } from 'path';
-
 import { generateModifyVars } from './build/generate/generateModifyVars';
 import { createProxy } from './build/vite/proxy';
 import { wrapperEnv } from './build/utils';
 import { createVitePlugins } from './build/vite/plugin';
 import { OUTPUT_DIR } from './build/constant';
-
-import pkg from './package.json';
-import moment from 'moment';
 
 function pathResolve(dir: string) {
   return resolve(process.cwd(), '.', dir);
@@ -19,7 +16,7 @@
 const { dependencies, devDependencies, name, version } = pkg;
 const __APP_INFO__ = {
   pkg: { dependencies, devDependencies, name, version },
-  lastBuildTime: moment().format('YYYY-MM-DD HH:mm:ss'),
+  lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
 };
 
 export default ({ command, mode }: ConfigEnv): UserConfig => {
@@ -53,31 +50,45 @@
           find: /\/#\//,
           replacement: pathResolve('types') + '/',
         },
-        // ['@vue/compiler-sfc', '@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js'],
       ],
     },
     server: {
+      https: true,
+      // Listening on all local IPs
+      host: true,
       port: VITE_PORT,
       // Load proxy configuration from .env
       proxy: createProxy(VITE_PROXY),
     },
+    esbuild: {
+      pure: VITE_DROP_CONSOLE ? ['console.log', 'debugger'] : [],
+    },
     build: {
       target: 'es2015',
+      cssTarget: 'chrome80',
       outDir: OUTPUT_DIR,
-      terserOptions: {
-        compress: {
-          keep_infinity: true,
-          // Used to delete console in production environment
-          drop_console: VITE_DROP_CONSOLE,
-        },
-      },
+      // minify: 'terser',
+      /**
+       * 褰� minify=鈥渕inify:'terser'鈥� 瑙e紑娉ㄩ噴
+       * Uncomment when minify="minify:'terser'"
+       */
+      // terserOptions: {
+      //   compress: {
+      //     keep_infinity: true,
+      //     drop_console: VITE_DROP_CONSOLE,
+      //   },
+      // },
       // Turning off brotliSize display can slightly reduce packaging time
       brotliSize: false,
       chunkSizeWarningLimit: 2000,
     },
     define: {
+      // setting vue-i18-next
+      // Suppress warning
+      __INTLIFY_PROD_DEVTOOLS__: false,
       __APP_INFO__: JSON.stringify(__APP_INFO__),
     },
+
     css: {
       preprocessorOptions: {
         less: {
@@ -93,13 +104,12 @@
     optimizeDeps: {
       // @iconify/iconify: The dependency is dynamically and virtually loaded by @purge-icons/generated, so it needs to be specified explicitly
       include: [
+        '@vue/runtime-core',
+        '@vue/shared',
         '@iconify/iconify',
         'ant-design-vue/es/locale/zh_CN',
-        'moment/dist/locale/zh-cn',
         'ant-design-vue/es/locale/en_US',
-        'moment/dist/locale/eu',
       ],
-      exclude: ['vue-demi'],
     },
   };
 };

--
Gitblit v1.8.0