74 lines
1.6 KiB
TypeScript
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',
|
|
},
|
|
});
|