-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
55 lines (54 loc) · 1.57 KB
/
vite.config.ts
File metadata and controls
55 lines (54 loc) · 1.57 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
import { reactRouter } from "@react-router/dev/vite";
import { defineConfig } from "vite";
import { VitePWA } from "vite-plugin-pwa";
import { clientOnlyPlugins } from "./plugins/client-only-plugins";
import vercelCustomEntrypoint from "./plugins/vercel-custom-entrypoint";
export default defineConfig({
plugins: [
reactRouter(),
VitePWA({
workbox: {
runtimeCaching: [
{
urlPattern: ({ url }) =>
/^\/\d+\/\d+\/register\.data$/.test(url.pathname),
handler: "NetworkFirst",
options: { networkTimeoutSeconds: 5 },
},
{
urlPattern: ({ url }) =>
/^\/\d+\/\d+\/register\.data$/.test(url.pathname),
// FIXME: not good to expect body-keyed idempotency with POST request
method: "POST",
handler: "NetworkOnly",
options: {
backgroundSync: { name: "register" },
},
},
],
navigateFallback: null,
},
manifest: {
lang: "ja",
theme_color: "#1976d2",
background_color: "#1976d2",
name: "Comiacapay",
short_name: "Comiacapay",
},
registerType: "autoUpdate",
devOptions: {
enabled: true,
suppressWarnings: true,
},
outDir: "build/client",
}),
vercelCustomEntrypoint({ main: "./main.ts" }),
clientOnlyPlugins({ filter: ["vite-plugin-pwa:build"] }),
],
resolve: {
tsconfigPaths: true,
},
define: {
"process.env.NODE_ENV": JSON.stringify(process.env["NODE_ENV"]),
},
});