-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
141 lines (137 loc) · 4.34 KB
/
Copy pathvite.config.js
File metadata and controls
141 lines (137 loc) · 4.34 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { VitePWA } from 'vite-plugin-pwa';
export const PWA_INJECT_REGISTER = 'script-defer';
export const PWA_WORKBOX_CONFIG = {
globPatterns: ['**/*.{js,css,html,ico,json,txt,woff2}', 'assets/logo-*.png'],
globIgnores: ['**/assets/exceljs*.js'],
runtimeCaching: [
{
urlPattern: ({ url }) => /\/assets\/exceljs\.min-[^/]+\.js$/.test(url.pathname),
handler: 'CacheFirst',
options: {
cacheName: 'chic-excel',
expiration: { maxEntries: 2, maxAgeSeconds: 60 * 60 * 24 * 365 },
cacheableResponse: { statuses: [0, 200] },
},
},
],
};
// https://vitejs.dev/config/
export default defineConfig(({ command }) => {
const base = command === 'build' ? '/ChIC/' : '/';
return {
base: base,
plugins: [
vue(),
VitePWA({
registerType: 'autoUpdate', // Or 'prompt' based on preference
injectRegister: PWA_INJECT_REGISTER,
workbox: PWA_WORKBOX_CONFIG,
manifest: {
name: 'Charité Imaging Classification Tool',
short_name: 'ChIC',
description: 'An application to group PLD progression data.', // Add a description
start_url: './?source=pwa',
display: 'standalone',
background_color: '#ffffff', // Optional: Add background color
theme_color: '#00bf7d',
icons: [
{
src: 'img/icons/favicon-16x16.png',
sizes: '16x16',
type: 'image/png',
},
{
src: 'img/icons/favicon-32x32.png',
sizes: '32x32',
type: 'image/png',
},
{
src: 'favicon.png',
sizes: '64x64',
type: 'image/png',
},
{
src: 'img/icons/apple-touch-icon-120x120.png',
sizes: '120x120',
type: 'image/png',
},
{
src: 'img/icons/apple-touch-icon-152x152.png',
sizes: '152x152',
type: 'image/png',
},
{
src: 'img/icons/apple-touch-icon-180x180.png',
sizes: '180x180',
type: 'image/png',
},
{
src: 'img/icons/apple-touch-icon.png',
sizes: '180x180',
type: 'image/png',
},
{
src: 'img/icons/android-chrome-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'img/icons/android-chrome-512x512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: 'img/icons/android-chrome-maskable-192x192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'maskable',
},
{
src: 'img/icons/android-chrome-maskable-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
{
src: 'img/icons/msapplication-icon-144x144.png',
sizes: '144x144',
type: 'image/png',
},
{
src: 'img/icons/mstile-150x150.png',
sizes: '150x150',
type: 'image/png',
},
],
},
devOptions: {
enabled: true, // Enable PWA features in dev mode if needed
},
}),
],
resolve: {
alias: {
'@': '/src', // If you use '@' alias
},
},
server: {
// Fixed non-standard port so the dev server never collides with other local
// dev servers (e.g. one already occupying 8080). Override via CHIC_DEV_PORT.
port: Number(process.env.CHIC_DEV_PORT) || 8137,
strictPort: true, // fail loudly instead of silently hopping to an unforwarded port
host: true, // bind 0.0.0.0 so a forwarded / remote browser can reach it
open: false, // headless / remote host: no local browser to auto-open
watch: {
usePolling: true,
},
},
preview: {
// Mirror the dev server: fixed non-standard port, override via CHIC_PREVIEW_PORT.
port: Number(process.env.CHIC_PREVIEW_PORT) || 8138,
strictPort: true,
host: true,
},
};
});