/** * Vite configuration for the minimal consumer application. * * @author Laurent Declercq l.declercq@agon-innovation.ch * @version 20260921 */ import { defineConfig } from 'vite'; import { fileURLToPath } from 'node:url'; import rtlcss from 'postcss-rtlcss'; import { adminBuild, adminHtml, adminIcons } from '@agon/atrium/vite'; import appearance from './appearance.config.mjs'; import { iconSources } from './icons.config.mjs'; import { routes } from './routes.js'; export default defineConfig( /** * Apply the shared build policy while preserving consumer-specific plugins and hosting options. * * @param {object} environment - Vite configuration environment. * @param {string} environment.mode - Selected development or production mode. * @returns {object} Complete application build and development configuration. */ ({ mode }) => ({ server: { allowedHosts: [ 'host.docker.internal' ], watch: { usePolling: true, interval: 300 } }, preview: { allowedHosts: [ 'host.docker.internal' ] }, base: process.env.APP_BASE || '/', plugins: [ adminIcons({ sources: iconSources }), adminHtml({ root: fileURLToPath(new URL('.', import.meta.url)), routes, appearance }) ], css: { postcss: { plugins: [ rtlcss() ] }, preprocessorOptions: { scss: { silenceDeprecations: [ 'import', 'global-builtin', 'color-functions', 'if-function' ], quietDeps: true } } }, build: adminBuild({ mode, minify: process.env.ATRIUM_MINIFY }) }) );