-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
48 lines (44 loc) · 1.22 KB
/
vite.config.ts
File metadata and controls
48 lines (44 loc) · 1.22 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
import { sveltekit } from "@sveltejs/kit/vite";
import type { UserConfig } from "vite";
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
import { SvelteKitPWA } from "@vite-pwa/sveltekit";
// Expose git version to the app
import child_process from "child_process";
const commitHash = child_process.execSync("git rev-parse --short HEAD").toString().trim();
console.log("Latest commit:", commitHash);
const branch =
process.env.HEAD ||
child_process.execSync("git rev-parse --symbolic-full-name --abbrev-ref HEAD").toString().trim();
console.log("Branch:", branch);
const config: UserConfig = {
logLevel: "info",
plugins: [
sveltekit(),
wasm(),
topLevelAwait(),
SvelteKitPWA({
srcDir: "./src",
scope: "/",
base: "/",
strategies: "generateSW",
/* devOptions: {
enabled: true,
type: "module",
navigateFallback: "/"
}, */
workbox: {
globPatterns: ["client/**/*.{js,css,ico,png,svg,webp,woff,woff2,html}"],
maximumFileSizeToCacheInBytes: 13000000 // 13mb
}
})
],
optimizeDeps: {
exclude: ["twothousand-forty-eight"]
},
define: {
__APP_VERSION__: JSON.stringify(commitHash),
__APP_BRANCH__: JSON.stringify(branch)
}
};
export default config;