-
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathvite.config.ts
More file actions
82 lines (79 loc) · 2.48 KB
/
Copy pathvite.config.ts
File metadata and controls
82 lines (79 loc) · 2.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { sveltekit } from "@sveltejs/kit/vite";
import tailwindcss from "@tailwindcss/vite";
import { SvelteKitPWA } from "@vite-pwa/sveltekit";
import { exec } from "child_process";
import { env } from "process";
import { promisify } from "util";
import type { UserConfig } from "vite";
// Get current tag/commit and last commit date from git
const pexec = promisify(exec);
const [version, sha] = (
await Promise.all([
env.VERSION ?? pexec("git describe --tags || git rev-parse --short HEAD").then((v) => v.stdout.trim()),
env.SHA ?? pexec("git rev-parse --short HEAD").then((v) => v.stdout.trim())
])
).map((v) => JSON.stringify(v));
const config: UserConfig = {
plugins: [
tailwindcss(),
sveltekit(),
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"
}
],
share_target: {
action: "/items/import",
method: "GET",
params: {
url: "url",
text: "text",
title: "title"
}
}
},
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()
},
build: {
rollupOptions: {
external: ["sharp"]
}
}
};
export default config;