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

vite.config.ts

29 lines816 Bytes

1import { defineConfig } from 'vite'
2import solid from 'vite-plugin-solid'
3import { tanstackRouter } from '@tanstack/router-plugin/vite'
4​
5const isVerboseFileRoutes = process.env.VERBOSE_FILE_ROUTES === '1' || false
6console.info(`Verbose file routes is set to: ${isVerboseFileRoutes}.`)
7​
8// https://vitejs.dev/config/
9export default defineConfig({
10 plugins: [
11 tanstackRouter({
12 target: 'solid',
13 autoCodeSplitting: true,
14 verboseFileRoutes: isVerboseFileRoutes,
15 codeSplittingOptions: {
16 splitBehavior: ({ routeId }) => {
17 if (routeId === '/posts') {
18 return [
19 ['loader'],
20 ['component'],
21 ['pendingComponent', 'notFoundComponent', 'errorComponent'],
22 ]
23 }
24 },
25 },
26 }),
27 solid(),
28 ],
29})