30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
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()],
|
|
build: {
|
|
// No content hashes in output filenames — cache-busting on redeploy is
|
|
// handled at the hosting/nginx level instead (see docs/bitrix-integration.md).
|
|
rolldownOptions: {
|
|
output: {
|
|
entryFileNames: 'assets/[name].js',
|
|
chunkFileNames: 'assets/[name].js',
|
|
assetFileNames: 'assets/[name].[ext]',
|
|
},
|
|
},
|
|
},
|
|
}
|
|
})
|