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

vite.config.ts

38 lines1.1 KB

1import { fileURLToPath } from 'node:url'
2import { defineConfig } from 'vitest/config'
3import react from '@vitejs/plugin-react'
4import codspeedPlugin from '@codspeed/vitest-plugin'
5import { cpuSimulationExecArgv } from '../../cpu-simulation'
6​
7// Anchor the project root to the package directory so this config resolves
8// identically when run directly and as part of an aggregate `projects` config.
9const rootDir = fileURLToPath(new URL('..', import.meta.url))
10​
11export default defineConfig({
12 root: rootDir,
13 define: {
14 'process.env.NODE_ENV': JSON.stringify('production'),
15 },
16 plugins: [
17 !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&
18 codspeedPlugin(),
19 react(),
20 ],
21 build: {
22 outDir: './react/dist',
23 emptyOutDir: true,
24 minify: false,
25 lib: {
26 entry: './react/app.tsx',
27 formats: ['es'],
28 fileName: 'app',
29 },
30 },
31 test: {
32 execArgv: cpuSimulationExecArgv(),
33 name: '@benchmarks/client-nav (react)',
34 watch: false,
35 environment: 'jsdom',
36 setupFiles: [`${rootDir}vitest.setup.ts`],
37 },
38})