-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
84 lines (72 loc) · 1.85 KB
/
Copy pathvite.config.ts
File metadata and controls
84 lines (72 loc) · 1.85 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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { VitePWA } from 'vite-plugin-pwa'
import { fileURLToPath } from 'node:url'
import { createHash, type BinaryLike } from 'node:crypto'
import { basename } from 'node:path'
import { generateVersionPlugin } from './vite-plugins/generate-version'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
generateVersionPlugin(),
// oxlint-disable-next-line new-cap
VitePWA({
devOptions: {
enabled: true
},
workbox: {
navigateFallbackDenylist: [/^\/api\/.*/u]
},
registerType: 'prompt',
injectRegister: null,
manifest: {
name: '2026 Tracker',
short_name: '2026 Tracker',
description: 'Track your 2026 goals and tasks',
theme_color: '#1a1a1a',
background_color: '#1a1a1a',
display: 'standalone',
start_url: '/',
icons: [{
src: '/pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
purpose: 'any'
}, {
src: '/pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any'
}]
}
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('src', import.meta.url))
}
},
server: {
proxy: {
'/api': {
target: 'http://localhost:8787'
}
}
},
css: {
modules: {
generateScopedName(className: string, filename: string, data: BinaryLike) : string {
const hash = createHash('sha256')
.update(data)
.digest('hex')
.slice(0, 6)
const filePath = filename
.replace(/\.vue(?:\?.+?)?$/u, '')
.replaceAll(/\[|\]/gu, '')
const baseName = basename(filePath)
return `${baseName}_${className}_${hash}`
}
}
}
})