forked from commaai/connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
95 lines (93 loc) · 2.37 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
import { defineConfig } from 'vite'
import solid from 'vite-plugin-solid'
import devtools from 'solid-devtools/vite'
import { sentryVitePlugin } from '@sentry/vite-plugin'
import { VitePWA } from 'vite-plugin-pwa'
// noinspection ES6PreferShortImport
import { Icons } from './src/components/material/Icon'
export default defineConfig({
plugins: [
devtools(),
solid({
ssr: false,
}),
VitePWA({
registerType: 'autoUpdate',
manifest: {
name: 'comma connect',
short_name: 'connect',
description: 'manage your openpilot experience',
background_color: '#131318',
theme_color: '#131318',
start_url: '/',
id: '/',
},
pwaAssets: {
config: true,
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,webp}'],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'google-fonts-stylesheets',
},
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com/,
handler: 'CacheFirst',
options: {
cacheName: 'google-fonts-webfonts',
cacheableResponse: {
statuses: [0, 200],
},
expiration: {
maxAgeSeconds: 365 * 24 * 60 * 60,
maxEntries: 30,
},
},
},
],
},
}),
{
name: 'inject-material-symbols',
transformIndexHtml(html) {
const icons = Icons.toSorted().join(',')
return {
html,
tags: [
{
tag: 'link',
attrs: {
rel: 'stylesheet',
href: `https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],400,0..1,0&icon_names=${icons}&display=block`,
},
injectTo: 'head',
},
],
}
},
},
// put the Sentry plugin after all other plugins
sentryVitePlugin({
org: 'commaai',
project: 'new-connect',
telemetry: false,
}),
],
server: {
port: 3000,
},
build: {
target: 'esnext',
sourcemap: true, // must be turned on for Sentry
},
resolve: {
alias: {
'~': '/src',
},
},
})