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

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    resolve: {
        alias: {
            '@': path.resolve(__dirname, './src'),
        },
    },
    // 解决跨域问题
    server: {
        host: '0.0.0.0',
        // port: 4000,
        proxy: {
            '/api': {
                target: 'http://192.168.110.218:8222',
                // secure: false, // 请求是否为https
                changeOrigin: true,
                rewrite:(path)=>path.replace(/^\/api/,'') //api替换为'',
            },
        },
    },



    // resolve: {
    //   alias: {
    //     '@': path.resolve(__dirname, 'src'),
    //   },
    // },
    css: {
        preprocessorOptions: {
            less: {
                additionalData: `@import "@/assets/style/base.less";`,
            }
        },
    },
})