-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathvite.config.ts
More file actions
105 lines (100 loc) · 3.54 KB
/
Copy pathvite.config.ts
File metadata and controls
105 lines (100 loc) · 3.54 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import path from 'path';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig({
test: {
environment: 'jsdom',
},
plugins: [
react(),
VitePWA({
// Use 'injectManifest' so our custom SW (app-sw.ts) controls precaching and runtime
// caching. The custom SW merges PWA precache + Stellar notification background sync.
strategies: 'injectManifest',
srcDir: 'src/sw',
filename: 'app-sw.ts',
outDir: 'dist',
manifest: {
name: 'Wraith Demo — Stealth Address SDK',
short_name: 'Wraith',
description:
'Developer demo for the Wraith Protocol stealth address SDK. Send and receive private payments on Horizen and Stellar.',
start_url: '/send',
scope: '/',
display: 'standalone',
orientation: 'portrait-primary',
theme_color: '#0e0e0e',
background_color: '#0e0e0e',
lang: 'en',
categories: ['finance', 'utilities'],
icons: [
{ src: '/icons/icon-72x72.png', sizes: '72x72', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-96x96.png', sizes: '96x96', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-128x128.png', sizes: '128x128', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-144x144.png', sizes: '144x144', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-152x152.png', sizes: '152x152', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-192x192.png', sizes: '192x192', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-384x384.png', sizes: '384x384', type: 'image/png', purpose: 'any' },
{ src: '/icons/icon-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any' },
{
src: '/icons/maskable-icon-192x192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'maskable',
},
{
src: '/icons/maskable-icon-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
screenshots: [
{
src: '/og-image.png',
sizes: '1200x630',
type: 'image/png',
label: 'Wraith Demo — Send and Receive',
// @ts-expect-error – form_factor is valid but not yet in typedefs
form_factor: 'wide',
},
],
},
manifestFilename: 'manifest.webmanifest',
injectRegister: 'auto',
// injectManifest config: controls what gets injected into self.__WB_MANIFEST
injectManifest: {
// Precache all built assets (JS, CSS, HTML, icons, fonts)
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
// Exclude the stellar-notification-sw (it's now merged into app-sw)
globIgnores: ['**/stellar-notification-sw*', '**/app-sw*'],
// Raise file size limit — Stellar SDK + wagmi chunks exceed 2 MiB
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024, // 4 MiB
},
devOptions: {
enabled: false, // Do not activate SW in dev (avoids stale cache confusion)
type: 'module',
},
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
buffer: 'buffer',
},
},
define: {
global: 'globalThis',
},
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis',
},
},
},
worker: {
format: 'es',
},
});