import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import AutoImport from 'unplugin-auto-import/vite' import svgLoader from 'vite-svg-loader' import path from 'path' // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), svgLoader(), AutoImport({ imports: [ 'vue' ] }), ], resolve: { // https://cn.vitejs.dev/config/#resolve-alias alias: { // 设置路径 '~': path.resolve(__dirname, './'), // 设置别名 '@': path.resolve(__dirname, './src/') }, // https://cn.vitejs.dev/config/#resolve-extensions extensions: ['.js'] }, server: { host: '0.0.0.0', proxy: { '/api': { // https://mailbox.biutag.com/api // http://127.0.0.1:8080 target: 'https://mailbox.biutag.com/api', changeOrigin: true, rewrite: (p) => p.replace(/^\/api/, '') } } }, build: { rollupOptions: { output: { entryFileNames: `assets/[name].${new Date().getTime()}.js`, chunkFileNames: `assets/[name].${new Date().getTime()}.js`, assetFileNames: `assets/[name].${new Date().getTime()}.[ext]`, compact: true, manualChunks: { vue: ['vue'] }, } } } })