companion/@applications/web/vite.config.ts
Claude Code c723dda9cf chore(web): 🔧 Update Vite plugins, build settings, and environment variables for API integration
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-04-03 09:17:58 -07:00

74 lines
1.6 KiB
TypeScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { VitePWA } from 'vite-plugin-pwa';
import { pnpmResolve } from '@lilith/vite-plugin-pnpm-resolve';
const SINGLETON_PACKAGES = [
'react',
'react-dom',
'styled-components',
'framer-motion',
];
export default defineConfig({
plugins: [
pnpmResolve(),
react(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['assets/icons/*.png'],
manifest: false, // We use our own public/manifest.json
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'],
runtimeCaching: [
{
urlPattern: /^https:\/\/companion-web\.lilith\.apricot\.local\/.*/i,
handler: 'NetworkFirst',
options: {
cacheName: 'companion-shell',
expiration: {
maxEntries: 50,
maxAgeSeconds: 24 * 60 * 60,
},
},
},
],
},
}),
],
resolve: {
dedupe: SINGLETON_PACKAGES,
},
optimizeDeps: {
include: [
...SINGLETON_PACKAGES,
'@emotion/is-prop-valid',
'shallowequal',
'stylis',
],
},
server: {
port: 5850,
host: true,
proxy: {
'/api': {
target: 'http://localhost:3850',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
'/socket.io': {
target: 'http://localhost:3850',
changeOrigin: true,
ws: true,
},
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
target: 'es2022',
},
worker: {
format: 'es',
},
});