import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' const host = '0.0.0.0' const port = 8445 const apiLocalProxyRewrite = (path: string) => `/static${path}` // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue(), vueJsx()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, server: { host, port, proxy: { '/api': { // target: 'http://shw.themoretech.com:31005/', // target: 'http://192.168.1.6:31009', target: 'http://shw.themoretech.com:31008/', // target: `http://${host}:${port}/`, // rewrite: apiLocalProxyRewrite, changeOrigin: true // rewrite: path => path.replace(/^\/api/, '') } } } })