import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import tailwindcss from '@tailwindcss/vite' import { fileURLToPath, URL } from 'node:url' // This SPA is served by the SPRO gateway as static files under a URL PREFIX // (see ../__init__.py → MODULE_PREFIX). `base` MUST equal that prefix WITH a // trailing slash, or the built asset URLs 404 behind the gateway. It also // becomes `import.meta.env.BASE_URL`, which src/api/index.ts uses to build the // data-API base — so the app keeps working if the prefix ever changes. const BASE = '/module/temper_overview/' export default defineConfig({ base: BASE, plugins: [vue(), tailwindcss()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, // Match PressV: dedupe the framework copies so a future `yarn link` of an // @sp-ui-kit/* package can't pull a second Vue/PrimeVue into the bundle. dedupe: ['vue', 'primevue', '@primevue/themes', '@primeuix/themes', 'primeicons'], }, build: { outDir: 'dist', emptyOutDir: true, // Eager, single-bundle build (the router uses static imports — see // src/router/index.ts). This page is embedded in a Grafana kiosk panel; a // single bundle that loads once avoids re-fetching lazy chunks over a flaky // shop-floor network. The committed dist/ is what the gateway serves — the // deploy host has no Node toolchain, so we never build there. chunkSizeWarningLimit: 1500, }, })