-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
67 lines (64 loc) · 2.05 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
import { sveltekit } from "@sveltejs/kit/vite";
import { SvelteKitPWA } from "@vite-pwa/sveltekit";
import { exec } from "child_process";
import { promisify } from "util";
import type { UserConfig } from "vite";
import { purgeCss } from "vite-plugin-tailwind-purgecss";
// Get current tag/commit and last commit date from git
const pexec = promisify(exec);
const [version, sha] = (
await Promise.all([pexec("git describe --tags || git rev-parse --short HEAD"), pexec("git rev-parse --short HEAD")])
).map((v) => JSON.stringify(v?.stdout.trim()));
const config: UserConfig = {
plugins: [
sveltekit(),
purgeCss(),
SvelteKitPWA({
registerType: "autoUpdate",
manifest: {
name: "Wishlist",
short_name: "Wishlist",
description: "Christmas wishlist you can share with the whole family.",
theme_color: "#423654",
icons: [
{
src: "/android-chrome-192x192.png",
sizes: "192x192",
type: "image/png"
},
{
src: "/android-chrome-512x512.png",
sizes: "512x512",
type: "image/png"
},
{
src: "/android-chrome-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any maskable"
}
]
},
devOptions: {
enabled: true,
type: "module",
navigateFallback: "/"
}
})
],
server: {
fs: {
// Allow serving files from one level up to the project root
allow: ["./static/"]
}
},
define: {
__VERSION__: version,
__COMMIT_SHA__: sha,
__LASTMOD__: Date.now()
},
optimizeDeps: {
exclude: ["oslo"]
}
};
export default config;