-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
vite.config.js
80 lines (76 loc) · 1.82 KB
/
vite.config.js
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
import config from './package.json';
import { defineConfig } from 'vite';
import { createHtmlPlugin } from 'vite-plugin-html';
import { VitePWA } from 'vite-plugin-pwa';
import git from 'git-rev-sync';
import path from 'path';
const CurrentVersion = 'v' + config.version + '-' + git.short();
// https://vitejs.dev/config/
export default defineConfig({
base: '/phi-chart-render/',
plugins: [
createHtmlPlugin({
inject: {
data: {
GIT_VERSION: CurrentVersion
}
}
}),
VitePWA({
injectRegister: 'auto',
registerType: 'autoUpdate',
workbox: {
cleanupOutdatedCaches: true,
runtimeCaching: [
{
urlPattern: /\/phi-chart-render(.*?)\.(png|ogg|ico|ttf)/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'assets-cache',
},
}
],
},
minify: true,
manifest: {
id: 'misaliu-phi-chart-render',
name: 'phi-chart-render',
short_name: 'phi-chart-render',
description: 'A Phigros chart render based on Pixi.js',
scope: '/phi-chart-render/',
display: 'standalone',
orientation: 'landscape',
background_color: '#000000',
includeAssets: [ './icons/favicon.ico' ],
icons: [
{
src: './icons/64.png',
sizes: '64x64',
type: 'image/png'
},
{
src: './icons/192.png',
sizes: '192x192',
type: 'image/png'
}
]
}
}),
],
define: {
GIT_VERSION: JSON.stringify(CurrentVersion)
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
},
server: {
host: '0.0.0.0',
port: 9000,
open: true
},
build: {
sourcemap: true
}
});