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

vite.config.ts

52 lines1.2 KB

1import { defineConfig } from 'vite'
2import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
3import viteSolid from 'vite-plugin-solid'
4import { isSpaMode } from './tests/utils/isSpaMode'
5import { isPrerender } from './tests/utils/isPrerender'
6import tailwindcss from '@tailwindcss/vite'
7​
8const spaModeConfiguration = {
9 enabled: true,
10 prerender: {
11 outputPath: 'index.html',
12 },
14​
15const prerenderConfiguration = {
16 enabled: true,
17 filter: (page: { path: string }) =>
18 ![
19 '/this-route-does-not-exist',
20 '/error-normalization',
21 '/redirect',
22 '/i-do-not-exist',
23 '/not-found',
24 '/specialChars/search',
25 '/specialChars/hash',
26 '/specialChars/malformed',
27 '/search-params/default',
28 '/transition',
29 '/users',
30 ].some((p) => page.path.includes(p)),
31 maxRedirects: 100,
33​
34const outDir = process.env.E2E_DIST_DIR ?? 'dist'
35​
36export default defineConfig({
37 resolve: { tsconfigPaths: true },
38 build: {
39 outDir,
40 },
41 server: {
42 port: 3000,
43 },
44 plugins: [
45 tailwindcss(),
46 tanstackStart({
47 spa: isSpaMode ? spaModeConfiguration : undefined,
48 prerender: isPrerender ? prerenderConfiguration : undefined,
49 }),
50 viteSolid({ ssr: true }),
51 ],
52})