-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvite.config.ts
More file actions
65 lines (63 loc) · 1.48 KB
/
Copy pathvite.config.ts
File metadata and controls
65 lines (63 loc) · 1.48 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
61
62
63
64
65
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import tailwindcss from "@tailwindcss/vite";
import { paraglideVitePlugin } from "@inlang/paraglide-js";
import { execSync } from "node:child_process";
function getAppVersion(): string {
try {
const tag = execSync("git describe --tags --abbrev=0", {
encoding: "utf-8",
}).trim();
return tag || "dev";
} catch {
return "dev";
}
}
export default defineConfig({
define: {
__APP_VERSION__: JSON.stringify(getAppVersion()),
},
plugins: [
paraglideVitePlugin({
project: "./project.inlang",
outdir: "./src/lib/paraglide",
strategy: ["cookie", "baseLocale"],
}),
tailwindcss(),
sveltekit(),
],
server: {
host: true,
allowedHosts: true,
port: 9093,
strictPort: true,
// // Disable HMR for production preview
// hmr: process.env.NODE_ENV === 'production' ? false : {
// port: 9094,
// host: 'localhost'
// }
},
build: {
rollupOptions: {
// Keep native modules external but bundle the rest
external: ["sqlite3", "ldapts"],
},
// Increase chunk size limit to allow bundling
chunkSizeWarningLimit: 2000,
// Bundle all dependencies except native ones
commonjsOptions: {
include: [/node_modules/],
transformMixedEsModules: true,
},
},
ssr: {
// Bundle non-native dependencies
noExternal: ["yaml"],
// Keep native modules external
external: ["sqlite3", "ldapts"],
// Optimize deps for development
optimizeDeps: {
include: ["yaml"],
},
},
});