import { defineConfig, type Plugin } from 'vite'; import react from '@vitejs/plugin-react'; import { bootScript } from '../../waybetter/packages/shell/src/frame/boot.ts'; /** `/boot.js` (index.html): the shell's first-frame script, generated by the wayBetter shell frame. */ function wayBetterBoot(): Plugin { return { name: 'waybetter-boot', configureServer(server) { server.middlewares.use('/boot.js', (_request, response) => { response.setHeader('Content-Type', 'text/javascript; charset=utf-8'); response.end(bootScript()); }); }, generateBundle() { this.emitFile({ type: 'asset', fileName: 'boot.js', source: bootScript() }); }, }; } export default defineConfig({ plugins: [react(), wayBetterBoot()], // The shell frame lives in the framework checkout (waybetter/): its imports of these resolve to // this app's copies, so there is one React and one dockview. resolve: { dedupe: ['react', 'react-dom', 'dockview', '@tauri-apps/api', 'acorn'] }, clearScreen: false, server: { host: '127.0.0.1', port: 1420, strictPort: true, watch: { ignored: ['**/src-tauri/**'] } }, preview: { host: '127.0.0.1', port: 1421, strictPort: true }, build: { target: ['es2022'], sourcemap: false }, });