import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';

export default defineConfig({
  plugins: [vue()],
  server: {
    proxy: {
      '/local': {
        target:'http://localhost:8888',
        changeOrigin: true,
        rewrite: (path)  => path.replace(/^\/local/,''),
      },
      '/pji': {
        // target:'http://36.110.106.156:11121', // 外网地址
        target:'http://10.14.86.147:9081', // 内网地址
        changeOrigin: true,
        rewrite: (path)  => path.replace(/^\/pji/,''),
      },
      '/docker': {
        target:'http://localhost:2375',
        changeOrigin: true,
        rewrite: (path)  => path.replace(/^\/docker/,''),
      },
    },
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
  build: {
    rollupOptions: {
      input: path.resolve(__dirname, 'index.html'),
    },
  },
});
