From 4e9b6cb1de8b584e960d5d053849e964f54c0ca3 Mon Sep 17 00:00:00 2001 From: Edan's Win11 <961150665@qq.com> Date: Tue, 3 Jun 2025 21:22:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sau_frontend/vite.config.js | 60 +++++++++++++++---------------------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/sau_frontend/vite.config.js b/sau_frontend/vite.config.js index 4de9dbc..ba91816 100644 --- a/sau_frontend/vite.config.js +++ b/sau_frontend/vite.config.js @@ -1,50 +1,38 @@ -import { fileURLToPath, URL } from 'node:url' - import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' -// import vueDevTools from 'vite-plugin-vue-devtools' +import { resolve } from 'path' // https://vite.dev/config/ export default defineConfig({ - plugins: [ - vue(), - // vueDevTools(), - ], + plugins: [vue()], resolve: { alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - '@assets': fileURLToPath(new URL('./src/assets', import.meta.url)), + '@': resolve(__dirname, 'src'), }, }, - optimizeDeps: { - exclude: ['fsevents'], + css: { + preprocessorOptions: { + scss: { + // 移除自动导入,改用@use语法 + } + } }, server: { - proxy: { - '/api': { - target: 'http://localhost:5409', - changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, ''), - // configure: (proxy, options) => { - // proxy.on('proxyReq', (proxyReq, req, res) => { - // // 支持SSE连接 - // if (req.url && req.url.includes('/login')) { - // proxyReq.setHeader('Accept', 'text/event-stream'); - // proxyReq.setHeader('Cache-Control', 'no-cache'); - // proxyReq.setHeader('Connection', 'keep-alive'); - // } - // }); - // proxy.on('proxyRes', (proxyRes, req, res) => { - // // 确保SSE响应头正确设置 - // if (req.url && req.url.includes('/login')) { - // proxyRes.headers['content-type'] = 'text/event-stream'; - // proxyRes.headers['cache-control'] = 'no-cache'; - // proxyRes.headers['connection'] = 'keep-alive'; - // proxyRes.headers['access-control-allow-origin'] = '*'; - // } - // }); - // } + port: 5173, + open: true + }, + build: { + outDir: 'dist', + sourcemap: false, + chunkSizeWarningLimit: 1600, + rollupOptions: { + output: { + manualChunks: { + vue: ['vue', 'vue-router', 'pinia'], + elementPlus: ['element-plus'], + utils: ['axios'] + } } } } -}) \ No newline at end of file +})