Files
xenia-pos-local/waiter_pwa/vite.config.js
T
bonaminandClaude Opus 5.5 905c2955b0 chore(build): frontends become one npm workspace; images build from client-services/
Platform-v2 step 2.1 (APPS_PLATFORM D-15):
- root package.json with workspaces (packages/*, waiter_pwa, manager_dashboard)
  and empty @xenia/{ui,i18n,api,access} skeletons (filled in 2.3-2.5)
- one root package-lock.json generated from the two old app locks, so every
  dependency keeps its exact version (a fresh resolve moved the Capacitor and
  Capgo native plugins and broke UI-bundle updates); apps keep nested trees
- waiter/manager Dockerfiles build with context client-services/ (npm ci per
  workspace), root .dockerignore replaces the per-app ones; manager on node 22
- Vite dedupes react/react-dom so source-imported packages share the app's React
- waiter eslint ignores build outputs and the Android project

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:47:29 +02:00

76 lines
2.4 KiB
JavaScript

import { rmSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
// `vite build --mode native` builds the UI bundled inside the Capacitor app:
// no service worker (the app ships its own files) and a separate output dir so
// it never mixes with the web build served by the venue's nginx.
export default defineConfig(({ mode }) => {
const native = mode === 'native'
return {
build: {
outDir: native ? 'dist-native' : 'dist',
},
// npm workspace (D-15): shared packages are imported from source, so make
// sure every import of React resolves to this app's copy.
resolve: {
dedupe: ['react', 'react-dom'],
},
server: {
host: '0.0.0.0',
port: 5173,
allowedHosts: ['all'],
proxy: {
'/api/ws': {
target: 'ws://localhost:8000',
ws: true,
changeOrigin: true,
},
'/api': {
target: 'http://localhost:8000',
changeOrigin: true,
},
},
},
plugins: [
react(),
// public/downloads/ holds the APK + UI bundle that venue servers hand out.
// It belongs in the web build only — never inside the app or its bundle.
native && {
name: 'xenia-strip-downloads',
closeBundle() {
rmSync(fileURLToPath(new URL('./dist-native/downloads', import.meta.url)), { recursive: true, force: true })
},
},
VitePWA({
disable: native,
registerType: 'prompt',
manifest: {
name: 'Xenia',
short_name: 'Xenia',
start_url: '/',
display: 'standalone',
background_color: '#0f172a',
theme_color: '#0f172a',
icons: [
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'maskable' },
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' },
],
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
runtimeCaching: [],
},
devOptions: {
enabled: false,
},
}),
],
}
})