Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

vite.config.ts

38 lines1000 Bytes

1import { defineConfig, mergeConfig } from 'vitest/config'
2import { tanstackViteConfig } from '@tanstack/vite-config'
3import react from '@vitejs/plugin-react'
4import packageJson from './package.json'
5​
6const config = defineConfig({
7 plugins: [react()],
8 // Add 'development' condition for tests to resolve @tanstack/router-core/isServer
9 // to the development export (isServer = undefined) instead of node (isServer = true)
10 ...(process.env.VITEST && {
11 resolve: {
12 conditions: ['development'],
13 },
14 }),
15 test: {
16 name: packageJson.name,
17 dir: './tests',
18 watch: false,
19 environment: 'jsdom',
20 typecheck: { enabled: true },
21 setupFiles: ['./tests/setupTests.tsx'],
22 },
23})
24​
25export default mergeConfig(
26 config,
27 tanstackViteConfig({
28 tsconfigPath: './tsconfig.build.json',
29 entry: [
30 './src/index.tsx',
31 './src/index.rsc.ts',
32 './src/index.dev.tsx',
33 './src/ssr/client.ts',
34 './src/ssr/server.ts',
35 ],
36 srcDir: './src',
37 }),