import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import {resolve} from 'path'; import Components from 'unplugin-vue-components/vite' import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers' export default defineConfig({ plugins: [vue(),Components({ resolvers: [ AntDesignVueResolver({ importStyle: 'less', // 一定要开启这个配置项 }), ], }),], resolve:{ //设置路径别名 alias: { '@': resolve(__dirname, './src'), '*': resolve('') }, }, define: { 'process.env': { "VUE_APP_API_BASE_URL":"http://192.168.1.119:8080/military", "VUE_APP_MQTT_HOST":"127.0.0.1", "VUE_APP_MQTT_PORT":8083, "VUE_APP_MQTT_TOPICS": "/server/warning/+/zdgl" } }, server: { host: true, // 类型:string | boolean 指定服务器应该监听哪个 IP 地址 port: 3100, // 类型: number 指定服务器端口 cors: true, // 类型: boolean | CorsOptions 为开发服务器配置 CORS。默认启用并允许任何源 hmr : true, // proxy: { // '^/api': { // target: 'http://192.168.1.119:800/api', // changeOrigin: true, // rewrite: (path) => path.replace(/^\/api/, '') // } // } }, css: { preprocessorOptions: { less: { modifyVars: { // 在这里自定义主题色等样式 'primary-color': '#62f7e8a2', 'link-color': '#00ffe4', 'border-color-base': '#00ffe4', 'text-color': '#000' }, javascriptEnabled: true, }, }, }, })