import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' import vueDevTools from 'vite-plugin-vue-devtools' import AutoImport from 'unplugin-auto-import/vite' import Components from 'unplugin-vue-components/vite' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' // https://vite.dev/config/ export default defineConfig({ plugins: [ vue(), vueJsx(), vueDevTools(), AutoImport({ imports: ['vue', 'vue-router', 'pinia'], resolvers: [ElementPlusResolver()], dts: true }), Components({ resolvers: [ElementPlusResolver()], dts: true }) ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) }, }, css: { preprocessorOptions: { scss: { additionalData: `@use "@/styles/variables.scss" as *;` } } }, server: { port: 5173, open: true, proxy: { '/api': { target: 'http://127.0.0.1:8080', changeOrigin: true, secure: false } } }, build: { rollupOptions: { output: { manualChunks: { 'vendor': ['vue', 'vue-router', 'pinia'], 'ui': ['element-plus'], 'charts': ['echarts'], 'utils': ['axios', 'dayjs'] } } } } })