-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathvite.config.ts
More file actions
60 lines (58 loc) · 1.84 KB
/
vite.config.ts
File metadata and controls
60 lines (58 loc) · 1.84 KB
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
import tailwindcss from '@tailwindcss/vite'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
import process from 'node:process'
import { resolve } from 'pathe'
import solidDevTools from 'solid-devtools/vite'
import { defineConfig } from 'vite'
import solidPlugin from 'vite-plugin-solid'
const isProduction = process.env.NODE_ENV === 'production' || !process.env.TAURI_ENV_DEBUG
const host = process.env.TAURI_DEV_HOST
export default defineConfig({
plugins: [
solidDevTools(),
tailwindcss(),
tanstackRouter({
routesDirectory: resolve('./src-app/routes'),
generatedRouteTree: resolve('./src-app/routes.gen.ts'),
autoCodeSplitting: true,
target: 'solid'
}),
solidPlugin()
],
// Environment variables starting with the item of `envPrefix`
// will be exposed in tauri's source code through `import.meta.env`.
envPrefix: ['VITE_', 'TAURI_ENV_*'],
publicDir: resolve('assets'),
resolve: {
alias: {
'#': resolve('./src-app'),
'~': resolve('./')
},
tsconfigPaths: true
},
clearScreen: false,
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host ? { protocol: 'ws', host, port: 1421 } : undefined,
watch: { ignored: ['**/src-tauri/**', '**/dist/**', '**/.output/**'] }
},
build: {
// Tauri uses Chromium on Windows and WebKit on macOS and Linux
target: process.env.TAURI_ENV_PLATFORM === 'windows' ? 'chrome105' : 'safari13',
minify: isProduction ? 'oxc' : false,
chunkSizeWarningLimit: 1024 * 2,
emptyOutDir: true,
manifest: true,
outDir: resolve('.output/frontend'),
rolldownOptions: {
input: resolve('index.html'),
output: {
entryFileNames: `assets/[name]-[hash].js`,
assetFileNames: `assets/[name]-[hash][extname]`,
chunkFileNames: `assets/[name]-[hash].js`
}
}
}
})