Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
115 lines (113 loc) · 4.28 KB
/
Copy pathvite.config.ts
File metadata and controls
115 lines (113 loc) · 4.28 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
import inertia from '@inertiajs/vite';
import { wayfinder } from '@laravel/vite-plugin-wayfinder';
import tailwindcss from '@tailwindcss/vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import laravel from 'laravel-vite-plugin';
import { bunny } from 'laravel-vite-plugin/fonts';
import { defineConfig, loadEnv } from 'vite';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '');
const isLocal = env.APP_ENV === 'local';
return {
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.ts'],
refresh: true,
fonts: [
bunny('Instrument Sans', {
weights: [400, 500, 600],
}),
],
}),
inertia(),
tailwindcss(),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
compilerOptions: {
isCustomElement: (tag) => tag.startsWith('media-'),
},
},
}),
vueJsx(),
wayfinder({
formVariants: true,
}),
VitePWA({
registerType: 'autoUpdate',
scope: '/',
base: '/',
workbox: {
mode: isLocal ? 'development' : 'production',
navigateFallback: null,
runtimeCaching: [
{
// Material Symbols stylesheet (short-lived, revalidate in background)
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'google-fonts-stylesheets',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 10,
},
},
},
{
// Material Symbols woff2 (immutable versioned files, keep for a year)
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'google-fonts-webfonts',
expiration: {
maxEntries: 30,
maxAgeSeconds: 60 * 60 * 24 * 10,
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
],
},
devOptions: {
enabled: !isLocal,
},
manifest: {
name: 'HSCStack',
short_name: 'HSCStack',
start_url: '/',
scope: '/',
display: 'standalone',
background_color: '#f8fafc',
theme_color: '#f8fafc',
icons: [
{
src: '/favicon.png',
sizes: '192x192',
type: 'image/png',
purpose: 'any',
},
{
src: '/favicon.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any',
},
{
src: '/favicon.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
}),
],
};
});