-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
101 lines (100 loc) · 2.47 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
/* eslint-disable node/prefer-global/process */
import ImportMetaEnvPlugin from '@import-meta-env/unplugin'
import tailwindcss from '@tailwindcss/vite'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import viteCompression from 'vite-plugin-compression'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({
css: {
preprocessorOptions: {
scss: {
api: 'modern',
silenceDeprecations: [
'legacy-js-api',
],
},
},
},
define: {
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'true',
BUILD_COMMIT: JSON.stringify(process.env.BUILD_COMMIT ?? 'undefined'),
BUILD_NUMBER: JSON.stringify(process.env.BUILD_NUMBER ?? '0'),
BUILD_TIMESTAMP: JSON.stringify(process.env.BUILD_TIMESTAMP ?? 'undefined'),
},
plugins: [
ImportMetaEnvPlugin.vite({
env: '.env',
example: '.env.example',
}),
tailwindcss(),
viteCompression(),
VitePWA({
includeAssets: [
'favicon.ico',
'apple-touch-icon.png',
],
injectRegister: 'auto',
manifest: {
name: '$projectName',
background_color: '#ffffff',
display: 'fullscreen',
icons: [
{
sizes: '512x512',
src: 'favicon_512x512.png',
type: 'image/png',
},
{
sizes: '192x192',
src: 'favicon_192x192.png',
type: 'image/png',
},
],
short_name: '$projectName',
theme_color: 'rgb(23, 23, 23)',
},
registerType: 'prompt',
strategies: 'generateSW',
workbox: {
navigateFallbackDenylist: [
/api/,
],
runtimeCaching: [
{
handler: 'CacheFirst',
options: {
cacheName: 's3-images',
cacheableResponse: {
statuses: [
0,
200,
], // cache responses with these statuses
},
expiration: {
maxAgeSeconds: 30 * 24 * 60 * 60, // cache for 30 days
},
matchOptions: {
ignoreSearch: true,
},
},
urlPattern: ({ url }): boolean => url.origin.includes('.s3.'),
},
],
},
}),
vue({
script: {
defineModel: true,
},
}),
],
resolve: {
alias: [
{
find: '@',
replacement: '/src',
},
],
},
})