-
Notifications
You must be signed in to change notification settings - Fork 16
/
vite.config.ts
39 lines (37 loc) · 1.39 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
import { exec } from 'node:child_process'
import { promisify } from 'node:util'
import react from '@vitejs/plugin-react-swc'
import { formatISO } from 'date-fns'
import { defineConfig, splitVendorChunkPlugin } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig(async () => {
const { stdout: revision } = await promisify(exec)('git rev-parse HEAD')
const shortVersion = revision.trim().slice(0, 7)
return {
server: { host: true },
define: {
GIT_VERSION: JSON.stringify(shortVersion),
BUILD_TIME: JSON.stringify(formatISO(new Date())),
},
build: { rollupOptions: { input: ['index.html', 'privacy-policy.html'] } },
plugins: [
react(),
splitVendorChunkPlugin(),
VitePWA({
registerType: 'autoUpdate',
devOptions: { enabled: false },
manifest: {
name: 'RetroAssembly',
short_name: 'RetroAssembly',
description: 'A personal retro game collection cabinet in your browser',
theme_color: '#be123c',
icons: [
{ src: '/assets/logo/logo-192x192.png', sizes: '192x192', type: 'image/png' },
{ src: '/assets/logo/logo-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any' },
{ src: '/assets/logo/maskable-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' },
],
},
}),
],
}
})