import { defineConfig } from "vite";
import viteBaseConfig from "./vite.base.config";
//import viteProdConfig from "./vite.prod.config";
import viteDevConfig from "./vite.dev.config";

// 通过策略模式返回对应的配置fsdfdsfdshttp://localhost:3001/views/index.htmlhttp://localhost:3001/views/index.html
const envResolver = {
    /** 
    "build": () => {
        return ({...viteBaseConfig, ...viteProdConfig});
    }, */
    "serve": () => {
      var config = {...viteBaseConfig, ...viteDevConfig};
      return ({...viteBaseConfig, ...viteDevConfig});
    }
    /*"test": () => Object.assign({}, viteBaseConfig, viteTestConfig)*/
}

export default defineConfig(({command}) => {
    // command 的类型为 "build" | "server" | "test"
    return envResolver[command]();
})
