-
Notifications
You must be signed in to change notification settings - Fork 7
/
vite.config.ts
60 lines (59 loc) · 1.5 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { resolve } from 'node:path'
import { URL, fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import solidPlugin from 'vite-plugin-solid'
import createExternal from 'vite-plugin-external'
import postcss from './postcss.config.js'
export default defineConfig({
plugins: [
createExternal({
externals: {
'sqlite3': 'sqlite3',
'node:crypto': 'crypto',
'node:path': 'path',
'node:os': 'os',
'node:fs': 'fs',
},
}),
solidPlugin(),
],
resolve: {
alias: {
'~/': fileURLToPath(new URL('frontend/', import.meta.url)),
'~b/': fileURLToPath(new URL('backend/', import.meta.url)),
'~s/': fileURLToPath(new URL('scripts/', import.meta.url)),
},
},
// prevent vite from obscuring rust errors
clearScreen: false,
// Tauri expects a fixed port, fail if that port is not available
server: {
strictPort: true,
},
// to make use of `TAURI_PLATFORM`, `TAURI_ARCH`, `TAURI_FAMILY`,
// `TAURI_PLATFORM_VERSION`, `TAURI_PLATFORM_TYPE` and `TAURI_DEBUG`
// env variables
envPrefix: ['VITE_', 'TAURI_'],
build: {
target: 'esnext',
rollupOptions: {
input: {
frontend: resolve(__dirname, './index.html'),
backend: resolve(__dirname, 'backend/index.ts'),
},
output: [
{
dir: 'dist',
},
{
dir: 'dist',
entryFileNames: '[name].js',
format: 'cjs',
},
],
},
},
css: {
postcss,
},
})