#
luxiaotao1123
2024-11-07 5b2cc0da81f06106c5bc749cdaf803ab3195b621
#
2个文件已修改
70 ■■■■ 已修改文件
zy-acs-flow/.env 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/vite.config.ts 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/.env
@@ -1,5 +1,5 @@
# COOL_BASE_IP = '10.242.136.69'
# COOL_BASE_IP = 'localhost'
COOL_BASE_IP = '192.168.4.53'
COOL_BASE_IP = 'localhost'
# COOL_BASE_IP = '192.168.4.53'
COOL_BASE_PORT = 8088
zy-acs-flow/vite.config.ts
@@ -1,19 +1,53 @@
import { defineConfig } from 'vite';
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path'
import { resolve } from 'path';
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@/': resolve('src') + '/'
    }
  },
  server: {
    port: 5000,
    host: '0.0.0.0'
  },
  base: './',
  envPrefix: "COOL_",
});
// export default defineConfig({
//   plugins: [react()],
//   resolve: {
//     alias: {
//       '@/': resolve('src') + '/'
//     }
//   },
//   server: {
//     port: 5000,
//     host: '0.0.0.0',
//     proxy: {
//       '/api': {
//         target: 'http://192.168.4.53:8088',
//         changeOrigin: true,
//         rewrite: (path) => path.replace(/^\/api/, ''),
//       },
//     },
//   },
//   base: './',
//   envPrefix: "COOL_",
// });
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd());
  return {
    plugins: [react()],
    resolve: {
      alias: {
        '@/': resolve('src') + '/',
      },
    },
    server: {
      port: 5000,
      host: '0.0.0.0',
      proxy: {
        '/api': {
          target: `http://${env.COOL_BASE_IP}:${env.COOL_BASE_PORT}`,
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/api/, ''),
        },
      },
    },
    base: './',
    envPrefix: 'COOL_',
  };
});