import { createVuePlugin } from 'vite-plugin-vue2'; import { defineConfig } from 'vite'; import path from 'path'; import viteSvgIcons from 'vite-plugin-cb-svg-icons'; function resolve(dir) { return path.join(__dirname, dir) } const httpType: string = 'http://' const proxyUrl: string = '10.20.12.55:60006/' // 代理地址设置 export default defineConfig({ resolve: { alias: { '@': resolve('src'), assets: resolve('src/assets'), services: resolve('src/services'), utils: resolve('@cmp/cmp-common/utils'), interface: resolve('@cmp/cmp-common/interface'), components: resolve('@cmp/cmp-common/components'), hooks: resolve('@cmp/cmp-common/hooks'), task: resolve('src/views/task'), filters: resolve('@cmp/cmp-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 }, '/attachment': { target: httpType + proxyUrl } } } });