-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
48 lines (47 loc) · 1.08 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import wasm from "vite-plugin-wasm";
import { VitePWA } from "vite-plugin-pwa";
import packageJson from "./package.json";
export default defineConfig({
base: "/diablo_web_simple/",
plugins: [
react(),
wasm(),
VitePWA({
base: "/diablo_web_simple/",
registerType: "autoUpdate",
workbox: {
runtimeCaching: [
{
urlPattern: /.*\.pdf$/,
handler: "NetworkFirst",
options: {
cacheName: "pdf-cache",
expiration: {
maxEntries: 5,
maxAgeSeconds: 7 * 24 * 60 * 60,
},
},
},
{
urlPattern: new RegExp("/.*\\.(?:html|css|js|wasm)$"),
handler: "CacheFirst",
options: {
cacheName: "static-resources",
expiration: {
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60,
},
},
},
],
navigateFallback: "/diablo_web_simple/index.html",
navigateFallbackAllowlist: [/^(?!.*\.pdf$).*$/],
},
}),
],
define: {
__APP_VERSION__: JSON.stringify(packageJson.version),
},
});