-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
124 lines (122 loc) · 3.16 KB
/
vite.config.ts
File metadata and controls
124 lines (122 loc) · 3.16 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import { VitePWA } from 'vite-plugin-pwa';
// https://vitejs.dev/config/
export default defineConfig({
cacheDir: './node_modules/.vite/saga-abilities',
plugins: [
react(),
VitePWA({
registerType: 'prompt',
includeAssets: ['favicon.svg', 'apple-touch-icon.svg', 'mask-icon.svg'],
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,json,vue,txt,woff2}'],
},
manifest: {
name: 'SAGA Abilities Manager',
short_name: 'SAGA Abilities',
description:
'An ability manager for SAGA TTRPG with advanced filtering and AbilityManual organization capabilities',
theme_color: '#4c6ef5',
icons: [
{
src: 'pwa-192x192.svg',
sizes: '192x192',
type: 'image/svg+xml',
},
{
src: 'pwa-512x512.svg',
sizes: '512x512',
type: 'image/svg+xml',
},
],
},
}),
nxViteTsPaths(),
nxCopyAssetsPlugin(['*.md']),
],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
build: {
target: 'es2020',
outDir: 'dist',
assetsDir: 'assets',
minify: 'terser',
emptyOutDir: true,
reportCompressedSize: true,
sourcemap: false,
cssCodeSplit: true,
manifest: true,
rollupOptions: {
external: [
/\.test\.(ts|tsx)$/,
/\.spec\.(ts|tsx)$/,
'vitest',
'@testing-library/react',
'@testing-library/jest-dom',
],
output: {
manualChunks: {
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
'mantine-core': ['@mantine/core', '@mantine/hooks'],
'mantine-extras': [
'@mantine/dates',
'@mantine/form',
'@mantine/modals',
'@mantine/notifications',
],
'pdf-vendor': ['jspdf', 'jspdf-autotable', 'html2canvas'],
'data-vendor': [
'@tanstack/react-query',
'@tanstack/react-table',
'zod',
],
icons: ['@tabler/icons-react'],
},
},
},
},
optimizeDeps: {
include: [
'react',
'react-dom',
'react-router-dom',
'@mantine/core',
'@mantine/hooks',
],
},
server: {
open: true,
port: 5173,
},
preview: {
port: 5174,
open: true,
headers: {
'Alt-Svc': 'h3=":443"; ma=86400',
'Cache-Control': 'public, max-age=31536000, immutable',
},
},
});
// Vitest configuration
export const testConfig = {
globals: true,
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
watch: false,
setupFiles: './src/test/setup.ts',
exclude: ['**/node_modules/**', '**/dist/**'],
coverage: {
reportsDirectory: './coverage/saga-abilities',
provider: 'v8',
reporter: ['text', 'html'],
exclude: ['node_modules/'],
},
};