-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
97 lines (95 loc) · 2.46 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
import path from 'node:path'
import mdx from '@mdx-js/rollup'
import { sentryVitePlugin } from '@sentry/vite-plugin'
import tailwindcss from '@tailwindcss/vite'
import { TanStackRouterVite } from '@tanstack/router-plugin/vite'
import basicSSL from '@vitejs/plugin-basic-ssl'
import react from '@vitejs/plugin-react-swc'
import compiler from 'babel-plugin-react-compiler'
import { defineConfig } from 'vite'
import dynamic from 'vite-plugin-dynamic-import'
import tsconfigPaths from 'vite-tsconfig-paths'
const isTest = process.env.NODE_ENV === 'test'
export default defineConfig({
build: {
sourcemap: true,
cssCodeSplit: false,
cssMinify: 'lightningcss',
modulePreload: { polyfill: false },
rollupOptions: {
output: {
chunkFileNames: 'assets/chunk-[hash:8].js',
manualChunks: {
react: ['react', 'react-dom'],
core: ['@tanstack/react-router', '@tanstack/react-query', '@sentry/react'],
},
},
},
},
esbuild: {
supported: {
'top-level-await': true,
},
},
server: {
port: 8080,
open: true,
},
envPrefix: ['SENTRY_', 'SPACETRADERS_', 'REACT_'],
test: {
globals: true,
environment: 'happy-dom',
setupFiles: './test/vitest.setup.ts',
clearMocks: true,
css: true,
},
css: {
modules: {
scopeBehaviour: 'local',
},
},
resolve: {
alias: {
'@/test': path.join(__dirname, 'test'),
'@': path.join(__dirname, 'src'),
},
},
plugins: [
basicSSL(),
tsconfigPaths(),
dynamic(),
{ enforce: 'pre', ...mdx() },
tailwindcss(),
[compiler],
react(),
!isTest && TanStackRouterVite(),
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: process.env.SENTRY_ORG_NAME,
project: process.env.SENTRY_PROJECT_NAME,
silent: true,
}),
// VitePWA({
// registerType: 'prompt',
// includeAssets: ['favicon.ico', 'apple-touch-icon.png'],
// manifest: {
// name: 'Wayfarer',
// short_name: 'Wayfarer',
// description: 'A SpaceTraders API interface',
// theme_color: '#18181b',
// icons: [
// {
// src: 'android-chrome-192x192.png',
// sizes: '192x192',
// type: 'image/png',
// },
// {
// src: 'android-chrome-256x256.png',
// sizes: '256x256',
// type: 'image/png',
// },
// ],
// },
// }),
],
})