storebound/apps/desktop/vite.config.ts

22 lines
956 B
TypeScript

import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import { freezeSafe } from './build/freeze-safe';
// Tauri loads the dev server from build.devUrl (http://127.0.0.1:1420) and the built files from ../dist.
export default defineConfig({
// freezeSafe: the bundle must load under Tauri's frozen Object.prototype (build/freeze-safe.ts)
plugins: [freezeSafe(), react()],
clearScreen: false,
server: { host: '127.0.0.1', port: 1420, strictPort: true, watch: { ignored: ['**/src-tauri/**'] } },
build: {
target: ['safari15', 'chrome110'],
outDir: 'dist',
emptyOutDir: true,
sourcemap: false,
// no inline scripts or styles: the CSP is script-src 'self', style-src 'self'
assetsInlineLimit: 0,
cssCodeSplit: false,
// two pages: the main window and the tray card (pre-created hidden by src-tauri/src/card.rs)
rollupOptions: { input: { main: 'index.html', card: 'card.html' } },
},
});