-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
125 lines (122 loc) · 2.67 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
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
import mdx from '@mdx-js/rollup'
import { TanStackRouterVite } from '@tanstack/router-vite-plugin'
import react from '@vitejs/plugin-react'
import { vavite } from 'vavite'
import type { UserConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
const config: UserConfig = {
buildSteps: [
{
name: 'client',
config: {
build: {
outDir: 'dist/client',
manifest: true,
sourcemap: process.env.ENABLE_SOURCEMAPS === 'true',
},
},
},
{
name: 'server',
config: {
build: {
target: 'node21',
ssr: true,
outDir: 'dist/server',
rollupOptions: {
onwarn(warning, handler) {
if (
warning.message.includes('is dynamically imported by') &&
warning.message.includes(
'dynamic import will not move module into another chunk',
)
) {
return
}
handler(warning)
},
},
},
},
},
],
plugins: [
VitePWA({
// https://vite-pwa-org.netlify.app/workbox/generate-sw.html
strategies: 'generateSW',
registerType: 'prompt',
workbox: {
maximumFileSizeToCacheInBytes: 10_000_000,
globPatterns: ['**/*.{js,css,html,ico,png,svg,webp}'],
navigateFallbackDenylist: [/^\/login\/google/],
navigateFallback: '/index.html',
},
devOptions: {
enabled: false, // https://vite-pwa-org.netlify.app/guide/development
suppressWarnings: false,
type: 'module',
navigateFallback: '/index.html',
},
manifest: {
theme_color: '#F4E2CA',
name: 'FastRat',
short_name: 'FastRat',
description:
'A starter kit with great DX for building PWA with Fastify + React',
icons: [
{
src: 'pwa-64x64.png',
sizes: '64x64',
type: 'image/png',
},
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: 'maskable-icon-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
screenshots: [
{
src: 'wide-screenshot.webp',
sizes: '1232x720',
type: 'image/webp',
form_factor: 'wide',
label: 'Homescreen of FastRat',
},
{
src: 'mobile-screenshot.webp',
sizes: '1046x1150',
type: 'image/webp',
label: 'Homescreen of FastRat',
},
],
},
}),
mdx(),
vavite({
reloadOn: 'static-deps-change',
serverEntry: 'src/index.ts',
handlerEntry: 'src/handler.ts',
serveClientAssetsInDev: true,
}),
react(),
TanStackRouterVite({
quoteStyle: 'single',
}),
],
ssr: {
noExternal: ['react-helmet-async'],
},
}
export default config