@@ -2,30 +2,28 @@ import { defineConfig } from "vite";
22import solidPlugin from "vite-plugin-solid" ;
33import { internalIpV4 } from "internal-ip" ;
44
5+ const mobile =
6+ process . env . TAURI_PLATFORM === "android" ||
7+ process . env . TAURI_PLATFORM === "ios" ;
8+
59// https://vitejs.dev/config/
6- export default defineConfig ( {
10+ export default defineConfig ( async ( ) => ( {
711 plugins : [ solidPlugin ( ) ] ,
812
913 // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
1014 // prevent vite from obscuring rust errors
1115 clearScreen : false ,
1216 // tauri expects a fixed port, fail if that port is not available
1317 server : {
14- host :
15- process . env . TAURI_PLATFORM === "android" ||
16- process . env . TAURI_PLATFORM === "ios"
17- ? "0.0.0.0"
18- : false ,
18+ host : mobile ? "0.0.0.0" : false ,
1919 port : 1420 ,
20- hmr :
21- process . env . TAURI_PLATFORM === "android" ||
22- process . env . TAURI_PLATFORM === "ios"
23- ? {
24- protocol : "ws" ,
25- host : await internalIpV4 ( ) ,
26- port : 1421 ,
27- }
28- : undefined ,
20+ hmr : mobile
21+ ? {
22+ protocol : "ws" ,
23+ host : await internalIpV4 ( ) ,
24+ port : 1421 ,
25+ }
26+ : undefined ,
2927 strictPort : true ,
3028 } ,
3129 // to make use of `TAURI_DEBUG` and other env variables
@@ -39,4 +37,4 @@ export default defineConfig({
3937 // produce sourcemaps for debug builds
4038 sourcemap : ! ! process . env . TAURI_DEBUG ,
4139 } ,
42- } ) ;
40+ } ) ) ;
0 commit comments