okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
3616148bb
main
1import { defineConfig } from 'vite' ; 2import react from '@vitejs/plugin-react' ; 3 4/** 5* Strata web shell. 6* 7* The engine host (server/) owns hardware detection, the model registry and the 8* local inference API. In dev we proxy /api to it so the browser talks to one 9* origin, exactly like the packaged app does. 10*/ 11export default defineConfig ({ 12plugins :[ 13react (), 14{ 15// KaTeX's stylesheet names every font three times (woff2, woff, ttf). The app's webviews all read woff2, so the other two are 16// dropped before Vite copies the files: ~300 KB of fonts instead of ~1.1 MB, and none of it loads until an answer has math (#3268). 17name :'katex-woff2-only' , 18enforce :'pre' , 19transform ( code , id ) { 20if ( ! id . includes ( 'katex' ) || ! id . split ( '?' )[ 0 ]. endsWith ( '.css' )) return null ; 21return code . replace ( / ,url\([^)]*\.woff\) format\("woff"\),url\([^)]*\.ttf\) format\("truetype"\) / g , '' ); 22}, 23}, 24], 25server :{ 26port :5199 , 27strictPort :true , 28proxy :{ 29'/api' :{ 30target :process . env . STRATA_HOST ?? 'http://127.0.0.1:8791' , 31changeOrigin :true , 32ws :true , 33}, 34}, 35}, 36build :{ 37target :'es2022' , 38outDir :'dist' , 39sourcemap :true , 40}, 41});