import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { resolve, dirname } from 'node:path' import { fileURLToPath } from 'url' import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite' // https://vitejs.dev/config/ export default defineConfig({ server: { host: '127.0.0.1', // 主机ip https: false, // 是否开启 https open: true, // 是否自动在浏览器打开(就是npm run dev后,会自动在浏览器打开这个项目的意思,而不需要我们再手动点一次网页链接) port: 5173, // 端口号默认值5173 // 代理,即'/api'会被转义成'http://192.168.11.11:8080',作用于接口前缀 proxy: { '/api': { target: `http://matrix34.tpddns.cn:60006`, // 后台接口前缀 changeOrigin: true, // 是否允许跨域 secure: false, // 如果是https接口,需要配置这个参数 rewrite: (path) => path.replace(/^\/api/, ''), }, }, }, plugins: [ vue(), VueI18nPlugin({ include: resolve(dirname(fileURLToPath(import.meta.url)), './src/i18n/locales/**'), }) ], })