import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { fileURLToPath, URL } from 'node:url' // https://vitejs.dev/config/ export default defineConfig({ base: '', plugins: [ vue(), ], optimizeDeps: { include: ['html2canvas'] }, build: { rollupOptions: { external: ['html2canvas'] } }, server: { host: '127.0.0.1', port: 7860, proxy: { '/api': { target: 'http://localhost:7861', // 后端运行在7861端口 changeOrigin: true, } } }, css: { preprocessorOptions: { scss: { api: 'modern-compiler' }, }, }, resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } } })