29 lines
775 B
TypeScript
29 lines
775 B
TypeScript
import { defineConfig, loadEnv } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import path from "path";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(({ command, mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), "");
|
|
console.log("当前环境:", env.VITE_APP_ENV);
|
|
console.log("使用的环境配置文件为:", env.VITE_APP_CONFIG_FILE);
|
|
console.log("当前环境 API 基础 URL:", env.VITE_API_URL);
|
|
return {
|
|
define: {
|
|
__APP_ENV__: JSON.stringify(env.VITE_APP_ENV),
|
|
__API_BASE_URL__: JSON.stringify(env.VITE_API_URL),
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "src"),
|
|
},
|
|
},
|
|
plugins: [vue()],
|
|
server: {
|
|
host: "0.0.0.0",
|
|
port: 3000,
|
|
open: true,
|
|
},
|
|
};
|
|
});
|