import { createVuePlugin } from 'vite-plugin-vue2' import { defineConfig } from 'vite' import path from 'path' import viteSvgIcons from 'vite-plugin-svg-icons' function resolve(dir) { return path.join(__dirname, dir) } const httpType: string = 'https://' const proxyUrl: string = '10.10.33.238:60006/' // 代理地址设置 export default defineConfig({ resolve: { alias: { '@': resolve('src'), assets: resolve('src/assets'), services: resolve('src/services'), utils: resolve('src/common/utils'), interface: resolve('src/common/interface'), components: resolve('src/common/components'), hooks: resolve('src/common/hooks'), task: resolve('src/views/task'), filters: resolve('src/common/filters'), views: resolve('src/views') } }, base: '/', plugins: [ // vue() createVuePlugin(), viteSvgIcons({ // Specify the icon folder to be cached iconDirs: [path.resolve(process.cwd(), './src/icons/svg')], // Specify symbolId format symbolId: 'icon-[dir]-[name]' }) ], server: { proxy: { '/api/sms': { target: 'ws://' + proxyUrl, changeOrigin: true, ws: false }, '/api': { target: httpType + proxyUrl, changeOrigin: true }, '/config-files': { target: httpType + proxyUrl } } } })