From 77b15609b62c9bcd80fcdfd65f134a06252920b9 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 14 四月 2025 17:11:21 +0800 Subject: [PATCH] 48px --- vite.config.ts | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 14 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 18ea869..64d976c 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,12 +1,13 @@ import vue from '@vitejs/plugin-vue'; import autoprefixer from 'autoprefixer'; +import { CodeInspectorPlugin } from 'code-inspector-plugin'; import { resolve } from 'path'; import tailwindcss from 'tailwindcss'; import type { ConfigEnv } from 'vite'; import { defineConfig, loadEnv } from 'vite'; -import { CodeInspectorPlugin } from 'code-inspector-plugin'; -import { visualizer } from 'rollup-plugin-visualizer'; - +// import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'; +// import AutoImport from 'unplugin-auto-import/vite'; +// import Components from 'unplugin-vue-components/vite'; import viteCompression from 'vite-plugin-compression'; import vueSetupExtend from 'vite-plugin-vue-setup-extend-plus'; const pathResolve = (dir: string) => { @@ -31,14 +32,20 @@ viteCompression({ threshold: 1024000, }), - visualizer({ - gzipSize: true, - brotliSize: true, - emitFile: false, - filename: 'stats.html', //鍒嗘瀽鍥剧敓鎴愮殑鏂囦欢鍚� - - open: true, //濡傛灉瀛樺湪鏈湴鏈嶅姟绔彛锛屽皢鍦ㄦ墦鍖呭悗鑷姩灞曠ず - }), + // AutoImport({ + // resolvers: [ElementPlusResolver()], + // }), + // Components({ + // resolvers: [ElementPlusResolver()], + // }), + // rollup-plugin-visualizer 鎵撳寘鍒嗘瀽锛屽紑鍚悗锛宯pm run build 鑷姩鎵撳紑鎵撳寘鍚庣殑妯″潡鍥� + // visualizer({ + // gzipSize: true, + // brotliSize: true, + // emitFile: false, + // filename: 'stats.html', //鍒嗘瀽鍥剧敓鎴愮殑鏂囦欢鍚� + // open: true, //濡傛灉瀛樺湪鏈湴鏈嶅姟绔彛锛屽皢鍦ㄦ墦鍖呭悗鑷姩灞曠ず + // }), ], root: process.cwd(), resolve: { alias }, @@ -50,11 +57,30 @@ host: '0.0.0.0', port: env.VITE_PORT as unknown as number, open: JSON.parse(env.VITE_OPEN), - hmr: false, + hmr: true, + proxy: { + '/events': { + target: 'http://localhost:3000', + changeOrigin: true, + }, + /** @description 鐧惧害璇煶璇嗗埆 */ + '/api/baidu/speech_recognition': { + target: 'https://aip.baidubce.com/rpc/2.0/tts/v1', + changeOrigin: true, + }, + /** @description 鐧惧害璇煶鍚堟垚 */ + '/api/baidu/speech_synthesis': { + target: 'https://aip.baidubce.com/rpc/2.0/tts/v1', + changeOrigin: true, + rewrite: (path) => { + const newPath = path.replace('/api/baidu/speech_synthesis', ''); + return newPath; + }, + }, + }, }, build: { - // outDir: 'dist/' + mode.mode, - outDir: 'dist', + outDir: env.VITE_OUTPUT_DIR || 'dist', chunkSizeWarningLimit: 1500, rollupOptions: { -- Gitblit v1.9.3