-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
103 lines (100 loc) · 2.63 KB
/
vite.config.ts
File metadata and controls
103 lines (100 loc) · 2.63 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { fileURLToPath, URL } from 'node:url';
import { VitePWA } from 'vite-plugin-pwa';
import vue from '@vitejs/plugin-vue';
import { defineConfig, loadEnv } from 'vite';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), 'VITE_');
const basePath = env.VITE_APP_BASE_PATH || '/';
const basePathWithLeadingSlash = basePath.startsWith('/') ? basePath : `/${basePath}`;
const normalizedBasePath = basePathWithLeadingSlash.endsWith('/')
? basePathWithLeadingSlash
: `${basePathWithLeadingSlash}/`;
return {
base: normalizedBasePath,
plugins: [
vue(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.svg', 'robots.txt', 'pwa-icon.svg'],
manifest: {
name: 'Tonal Scale',
short_name: 'Tonal',
description: 'Tonal Scale progressive web app scaffold.',
theme_color: '#1867c0',
background_color: '#121212',
display: 'standalone',
start_url: normalizedBasePath,
scope: normalizedBasePath,
orientation: 'portrait',
icons: [
{
src: 'pwa-icon.svg',
sizes: 'any',
type: 'image/svg+xml',
},
{
src: 'pwa-icon.svg',
sizes: 'any',
type: 'image/svg+xml',
purpose: 'maskable',
},
],
},
workbox: {
cleanupOutdatedCaches: true,
runtimeCaching: [],
maximumFileSizeToCacheInBytes: 6 * 1024 * 1024,
},
}),
],
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
sass: {
api: 'modern-compiler',
},
},
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
port: 5173,
},
test: {
globals: true,
environment: 'jsdom',
css: true,
setupFiles: 'src/tests/setup.ts',
coverage: {
provider: 'v8',
reporter: ['text', 'json-summary', 'html'],
reportsDirectory: 'coverage/unit',
exclude: [
'temp/**',
'src/js/**',
'dist/**',
'cypress/**',
'**/*.d.ts',
'**/*.config.{js,ts,cjs,mjs}',
'**/.eslintrc.cjs',
'**/.stylelintrc.cjs',
'src/main.ts',
'src/tests/**',
],
thresholds: {
global: {
statements: 90,
branches: 90,
functions: 90,
lines: 90,
},
},
},
},
};
});