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

vite.config.ts

47 lines1.1 KB

1import { defineConfig } from 'vite'
2import tsConfigPaths from 'vite-tsconfig-paths'
3import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
4import viteSolid from 'vite-plugin-solid'
5import { isSpaMode } from './tests/utils/isSpaMode'
6import { isPrerender } from './tests/utils/isPrerender'
7import tailwindcss from '@tailwindcss/vite'
8​
9const spaModeConfiguration = {
10 enabled: true,
11 prerender: {
12 outputPath: 'index.html',
13 },
15​
16const prerenderConfiguration = {
17 enabled: true,
18 filter: (page: { path: string }) =>
19 ![
20 '/this-route-does-not-exist',
21 '/redirect',
22 '/i-do-not-exist',
23 '/not-found/via-beforeLoad',
24 '/not-found/via-loader',
25 '/search-params/default',
26 '/transition',
27 '/users',
28 ].some((p) => page.path.includes(p)),
29 maxRedirects: 100,
31​
32export default defineConfig({
33 server: {
34 port: 3000,
35 },
36 plugins: [
37 tailwindcss(),
38 tsConfigPaths({
39 projects: ['./tsconfig.json'],
40 }),
41 tanstackStart({
42 spa: isSpaMode ? spaModeConfiguration : undefined,
43 prerender: isPrerender ? prerenderConfiguration : undefined,
44 }),
45 viteSolid({ ssr: true }),
46 ],
47})