| 1 | import { defineConfig } from 'vite' |
| 2 | import vue from '@vitejs/plugin-vue' |
| 3 | import { resolve } from 'path' |
| 4 | |
| 5 | // https://vite.dev/config/ |
| 6 | export default defineConfig({ |
| 7 | plugins: [vue()], |
| 8 | resolve: { |
| 9 | alias: { |
| 10 | '@': resolve(__dirname, 'src'), |
| 11 | }, |
| 12 | }, |
| 13 | css: { |
| 14 | preprocessorOptions: { |
| 15 | scss: { |
| 16 | // 移除自动导入,改用@use语法 |
| 17 | } |
| 18 | } |
| 19 | }, |
| 20 | server: { |
| 21 | port: 5173, |
| 22 | open: true, |
| 23 | proxy: { |
| 24 | '/api': { |
| 25 | target: 'http://localhost:5409', |
| 26 | changeOrigin: true, |
| 27 | rewrite: (path) => path.replace(/^\/api/, '') |
| 28 | } |
| 29 | } |
| 30 | }, |
| 31 | build: { |
| 32 | outDir: 'dist', |
| 33 | sourcemap: false, |
| 34 | chunkSizeWarningLimit: 1600, |
| 35 | rollupOptions: { |
| 36 | output: { |
| 37 | manualChunks: { |
| 38 | vue: ['vue', 'vue-router', 'pinia'], |
| 39 | elementPlus: ['element-plus'], |
| 40 | utils: ['axios'] |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | }) |
| 46 |