Files
project-manager/web/vite.config.ts
T
aneurinandClaude Sonnet 5 d9db4a3a30 Serve the built SPA from the PHP image; drop the web container
The Dockerfile is now multi-stage: a Node stage runs `npm run build`, and the
PHP/Apache stage copies the result into public/. Apache + public/.htaccess route
/api* to the Slim front controller, serve real files, and fall back to
index.html for client-side routes.

docker-compose.yml loses the `web` service, its volume, and the source
bind-mount -- the image is the artifact now (rebuild to pick up changes).
Frontend dev moves to `npm run dev` on the host; APP_URL defaults to :8080 since
the one container serves both halves.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 13:37:07 +01:00

53 lines
1.4 KiB
TypeScript

import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
// Host-only dev server: proxy `/api` to the Dockerised API published on the
// host. Override with VITE_PROXY_TARGET if the API runs elsewhere.
const proxyTarget = process.env.VITE_PROXY_TARGET ?? 'http://localhost:8080'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.svg', 'apple-touch-icon.png'],
manifest: {
name: 'Project Manager',
short_name: 'Projects',
description: 'A simple project manager.',
theme_color: '#4f46e5',
background_color: '#ffffff',
display: 'standalone',
start_url: '/',
icons: [
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
{
src: 'pwa-maskable-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
devOptions: {
// Let the service worker run under `npm run dev` too.
enabled: true,
},
}),
],
server: {
host: true,
port: 5173,
strictPort: true,
proxy: {
'/api': {
target: proxyTarget,
changeOrigin: true,
},
},
},
})