-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
87 lines (82 loc) · 2.37 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import {defineConfig, UserConfigExport} from "vite";
import vue from "@vitejs/plugin-vue";
import vuetify, {transformAssetUrls} from "vite-plugin-vuetify";
import {fileURLToPath} from "url";
import { viteSingleFile } from "vite-plugin-singlefile"
import merge from "deepmerge";
// https://vitejs.dev/config/
export default defineConfig((mode) => {
const commonConfig: UserConfigExport = {
resolve: {
extensions: [
'.js',
'.json',
'.jsx',
'.mjs',
'.ts',
'.tsx',
],
},
clearScreen: false,
envPrefix: ["VITE_", "TAURI_"],
build: {
target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
// don't minify for debug builds
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
// produce sourcemaps for debug builds
sourcemap: !!process.env.TAURI_DEBUG,
emptyOutDir: true,
}
};
if (mode.mode === "discord") {
if (mode.command === "serve") {
console.log("Discord mode is not supported in dev mode.");
process.exit(1);
}
return merge(commonConfig, {
resolve: {
...commonConfig.resolve,
alias: {
'@': fileURLToPath(new URL('./src-tauri/web', import.meta.url))
}
},
plugins: [viteSingleFile({
removeViteModuleLoader: false,
})],
root: "src-tauri/",
build: {
outDir: "dist",
sourcemap: false,
rollupOptions: {
input: {
app: "src-tauri/web/index.html"
}
}
}
})
}
return merge(commonConfig, {
plugins: [
vue({
template: {
transformAssetUrls
}
}),
vuetify({
autoImport: true
})
],
server: {
port: 1420,
strictPort: true,
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
extensions: [
'.vue'
]
}
});
});