-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
75 lines (71 loc) · 2.1 KB
/
vite.config.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import {defineConfig} from 'vite'
import {sveltekit} from '@sveltejs/kit/vite'
const host = process.env.TAURI_DEV_HOST
const platform = process.env.TAURI_ENV_PLATFORM
const debugMode = Boolean(process.env.TAURI_ENV_DEBUG)
console.debug({host, platform, debugMode})
const packagesCdnUrl = 'https://packages.frankie.tools//noa'
const releaseType = debugMode
? 'debug'
: 'release'
const assets = {
target: 'http://localhost:3000',
changeOrigin: true,
// rewrite: (path) =>
// path.replace(/^\/.well-known\/assetlinks.json/, 'assetlinks.json'),
secure: false,
ws: false,
// configure: (proxy, options) => {
// proxy.on('error', (err, request, response) => {
// console.log('proxy error', err)
// })
// proxy.on('proxyReq', (proxyReq, request, response) => {
// console.log('Sending Request to the Target:', request.method, request.url)
// // console.log(request.headers)
// })
// proxy.on('proxyRes', (proxyRes, request, response) => {
// console.log('Response:', proxyRes.statusCode, request.url)
// })
// },
}
export default defineConfig({
plugins: [
sveltekit(),
],
// Vite options tailored for Tauri development.
// Only applied in `tauri dev` or `tauri build`
define: {
PLATFORM: JSON.stringify(platform),
packagesCdnUrl: JSON.stringify(packagesCdnUrl),
releaseType: JSON.stringify(releaseType),
},
// 1. prevent vite from obscuring rust errors
clearScreen: false,
// 2. tauri expects a fixed port, fail if that port is not available
server: {
port: 1520,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: 'ws',
host,
port: 1521,
}
// eslint-disable-next-line no-undefined
: undefined,
watch: {
// 3. tell vite to ignore watching `src-tauri`
ignored: [
'**/src-tauri/**',
'**/test-results/**',
// '**/playwright-report/**',
],
},
proxy: {'/.well-known/assetlinks.json': assets},
},
resolve: process.env.VITEST
? {conditions: ['browser']}
// eslint-disable-next-line no-undefined
: undefined,
})