import { defineConfig, loadEnv } from 'vite' import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig(({ mode }) => { // VITE_BASE_PATH is read here (config/Node context), so it needs an explicit // loadEnv call — unlike VITE_BITRIX_ORIGIN, which Vite injects into // import.meta.env automatically because it's only read from app code. const env = loadEnv(mode, process.cwd(), '') return { // Needed when the build is served from a subpath (e.g. local/diagram-app/ // inside the Bitrix docroot) instead of domain root — see // docs/bitrix-integration.md §7. base: env.VITE_BASE_PATH || '/', plugins: [react()], } })