/* * @Author: October 382756525@qq.com * @Date: 2022-07-29 15:19:22 * @LastEditors: October 382756525@qq.com * @LastEditTime: 2022-11-08 23:10:34 * @Description: * */ import { ConfigEnv, UserConfigExport } from 'vite' import { viteMockServe } from 'vite-plugin-mock' import vue from '@vitejs/plugin-vue' import path from 'path' const baseUrl = 'http://nps.scqtkj.com:51481/api/' // const baseUrl = "http://192.168.2.14:8088"; // const baseUrl = "http://10.10.10.14:8088"; // const baseUrl = "http://10.10.10.11:8088"; export default ({ command }: ConfigEnv): UserConfigExport => { return { plugins: [ vue(), viteMockServe({ // default mockPath: 'mock', localEnabled: command === 'serve' }) ], resolve: { alias: { '@': path.resolve(__dirname, 'src') } }, server: { host: true, proxy: { '/api': { target: baseUrl, // target: "http://192.168.2.11:8088/", // target: "http://nps.scqtkj.com:51490/", changeOrigin: true // rewrite: (path) => { // console.log(path); // // return path.replace(/^\/api/, ""); // }, // rewrite: (path) => path.replace(/^\/api/, ""), }, '/no-api': { target: baseUrl, // target: "http://192.168.2.11:8088/", // target: "http://nps.scqtkj.com:51490/", changeOrigin: true, // rewrite: (path) => { // console.log(path); // // return path.replace(/^\/api/, ""); // }, rewrite: (path) => path.replace(/^\/no-api/, '') }, // "/minio": { // target: baseUrl, // // target: "http://192.168.2.11:8088/", // // target: "http://nps.scqtkj.com:51490/", // changeOrigin: true, // // rewrite: (path) => { // // console.log(path); // // // return path.replace(/^\/api/, ""); // // }, // rewrite: (path) => // path.replace("/minio/", "http://221.10.90.184:8181/minio/") // }, '^/minio/.*': { target: baseUrl, changeOrigin: true, rewrite: (path) => path.replace(/^\/minio/, 'http://221.10.90.184:8181/minio/') } } } } } // https://vitejs.dev/config/ // export default defineConfig({ // plugins: [ // vue(), // viteMockServe({ // // default // mockPath: "mock", // localEnabled: command === "serve", // }), // ], // resolve: { // alias: { "@": path.resolve(__dirname, "src") }, // }, // });