import { defineConfig, loadEnv } from "vite"; import baseConfig from "./vite.config.base"; // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { // Load env file based on `mode` in the current working directory. // Set the third parameter to '' to load all env regardless of the `VITE_` prefix. const env = loadEnv(mode, process.cwd(), ''); const platform = env.PLATFORM || 'web'; // Load platform-specific config const platformConfig = require(`./vite.config.${platform}`).default; return { ...baseConfig, ...platformConfig, }; });