SPA_TemperProductionOverview/vite.config.ts
Erik aa115a0b8d feat: scaffold Temper-Linie live-overview page-module (temper_overview)
Vue 3 + Vite 8 + TS + PrimeVue 4 (Nora/Industrial) + Pinia + vue-i18n SPA, served
by the SPRO gateway as a static page-module under /module/temper_overview and
embedded into Grafana via iframe.

- Ports the LOCKED design #4 "Shop-floor Schematic": one connected line
  Pressen -> (cyan) -> Ofen -> (green) -> Fertig; carts under their origin press;
  oven trays as dwell-progress bars; finished band; range picker scoping only the
  Fertig figures. Flow/order colours match PressV (fleet recognisability).
- Python page-module wrapper: register(app) mounts committed dist/ + a no-auth
  read API (GET /api/overview). Kernel DB seam in _db.py.
- Backend returns SAMPLE data; frontend falls back to bundled sample so `npm run
  dev` renders with zero backend (TODO markers point at the real temper aggregates).
- Rich README bakes in the design, contract, wiring + Grafana embedding for
  standalone development.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 20:41:04 +02:00

35 lines
1.5 KiB
TypeScript

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,
},
})