-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
45 lines (43 loc) · 937 Bytes
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* Vite config.
*
* @description Vite config.
* @see https://vitejs.dev/config/
*/
import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'
import { internalIpV4 } from 'internal-ip'
import pkg from './package.json'
// @ts-expect-error process is a nodejs global
const mobile = !!/android|ios/.exec( process.env.TAURI_ENV_PLATFORM )
const host = await internalIpV4()
const port = 13129 // important for match with tauri.config.json
const server = {
port,
strictPort : true,
host : mobile ? '0.0.0.0' : false,
hmr : mobile ? {
protocol : 'ws',
host,
port,
} : undefined,
}
export default defineConfig( {
plugins : [
sveltekit(),
],
server,
preview : server,
define : {
PKG : pkg,
},
envPrefix : [
'VITE_',
'TAURI_PLATFORM',
'TAURI_ARCH',
'TAURI_FAMILY',
'TAURI_PLATFORM_VERSION',
'TAURI_PLATFORM_TYPE',
'TAURI_DEBUG',
],
} )