Open History to see the last commit
1import { defineConfig } from 'vite'
2import tsConfigPaths from 'vite-tsconfig-paths'
3import { tanstackStart } from '@tanstack/react-start/plugin/vite'
4import viteReact from '@vitejs/plugin-react'
5import { isSpaMode } from './tests/utils/isSpaMode'
6import { isPrerender } from './tests/utils/isPrerender'
7β
8const spaModeConfiguration = {
9 enabled: true,
10 prerender: {
11 outputPath: 'index.html',
12 },
13}
14β
15const prerenderConfiguration = {
16 enabled: true,
17 filter: (page: { path: string }) =>
18 ![
19 '/this-route-does-not-exist',
20 '/redirect',
21 '/i-do-not-exist',
22 '/not-found/via-beforeLoad',
23 '/not-found/via-loader',
24 ].some((p) => page.path.includes(p)),
25 maxRedirects: 100,
26}
27β
28export default defineConfig({
29 server: {
30 port: 3000,
31 },
32 plugins: [
33 tsConfigPaths({
34 projects: ['./tsconfig.json'],
35 }),
36 // @ts-ignore we want to keep one test with verboseFileRoutes off even though the option is hidden
37 tanstackStart({
38 spa: isSpaMode ? spaModeConfiguration : undefined,
39 prerender: isPrerender ? prerenderConfiguration : undefined,
40 }),
41 viteReact(),
42 ],
43})