-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathvite.config.ts
105 lines (103 loc) · 2.84 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
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';
import { createHtmlPlugin } from 'vite-plugin-html';
import { VitePWA } from 'vite-plugin-pwa';
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd());
return defineConfig({
build: {
outDir: 'build',
rollupOptions: {
output: {
manualChunks: {
react: ['react', 'react-dom'],
antdResult: ['antd/es/result'],
antdTable: ['antd/es/table'],
antdIcons: ['@ant-design/icons'],
uplot: ['uplot'],
sentry: ['@sentry/react', '@sentry/browser', '@sentry/tracing'],
kbar: ['kbar'],
perfectScrollbar: ['perfect-scrollbar'],
pako: ['pako'],
},
},
},
},
server: {
open: true,
host: '0.0.0.0',
},
css: {
preprocessorOptions: {
less: { javascriptEnabled: true },
},
},
plugins: [
react(),
visualizer(),
createHtmlPlugin({
template: '/index.html',
inject: {
data: {
metaTitle: env.VITE_META_TITLE,
metaDescription: env.VITE_META_DESCRIPTION,
metaImage: `${env.VITE_WEB_URL}/img/screen2.png`,
metaUrl: env.VITE_WEB_URL,
metaThemeColor: env.VITE_META_THEME_COLOR,
},
},
}),
VitePWA({
registerType: null,
injectRegister: null,
selfDestroying: true,
devOptions: { enabled: true },
manifest: {
name: env.VITE_META_TITLE,
short_name: env.VITE_META_TITLE,
description: env.VITE_META_DESCRIPTION,
start_url: '.',
display: 'standalone',
theme_color: env.VITE_META_THEME_COLOR,
background_color: env.VITE_META_THEME_COLOR,
icons: [
{
src: '/icons/icon.ico',
type: 'image/x-icon',
sizes: '256x256',
},
{
src: '/icons/icon.png',
type: 'image/png',
sizes: '812x812',
},
],
screenshots: [
{
src: '/img/screen1.png',
sizes: '3008x2050',
type: 'image/png',
platform: 'wide',
label: 'Tune view',
},
{
src: '/img/screen2.png',
sizes: '3008x2050',
type: 'image/png',
platform: 'wide',
label: 'Log viewer',
},
{
src: '/img/screen3.png',
sizes: '3008x2050',
type: 'image/png',
platform: 'wide',
label: 'Tooth log viewer',
},
],
},
}),
],
});
};