-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
41 lines (39 loc) · 1.14 KB
/
vite.config.ts
File metadata and controls
41 lines (39 loc) · 1.14 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
import { reactRouter } from '@react-router/dev/vite'
import tailwindcss from '@tailwindcss/vite'
import preserveDirectives from 'rollup-preserve-directives'
import { defineConfig, loadEnv } from 'vite'
export default defineConfig(({ mode }) => {
// Make .env variables available in tests
// Might be required only because reactRouter() is disabled in test mode
if (mode === 'test') {
// Loads .env, .env.test, etc.
const env = loadEnv(mode, process.cwd(), '')
Object.assign(process.env, env)
}
return {
server: {
port: 3000,
},
plugins: [
tailwindcss(),
// https://github.com/remix-run/remix/issues/9871 prevents this from
// being enabled in test mode...
mode === 'test' ? null : reactRouter(),
preserveDirectives(), // makes sure directives such as "use client" are present in the output bundle
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./vitest.setup.ts'],
include: ['**/*.{test,spec}.{ts,tsx}'],
coverage: {
reporter: ['text', 'json-summary', 'json'],
},
testTimeout: 10_000,
hookTimeout: process.env.CI ? 30_000 : 10_000,
},
resolve: {
tsconfigPaths: true,
},
}
})