1234567891011121314151617181920212223242526 |
- import { fileURLToPath, URL } from 'node:url'
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- // https://vitejs.dev/config/
- export default defineConfig({
- plugins: [vue()],
- server: {
- host: true,
- port: 9999,
- proxy: {
- '/api': {
- target: 'http://10.113.248.4:8666/', //目标url
- changeOrigin: true, //支持跨域
- rewrite: (path) => path.replace(/^\/api/, ""),
- //重写路径,替换/api
- }
- }
- },
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- }
- })
|