@depup/tanstack__react-router 1.166.4-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -0
  3. package/dist/cjs/Asset.cjs +177 -0
  4. package/dist/cjs/Asset.cjs.map +1 -0
  5. package/dist/cjs/Asset.d.cts +5 -0
  6. package/dist/cjs/CatchBoundary.cjs +114 -0
  7. package/dist/cjs/CatchBoundary.cjs.map +1 -0
  8. package/dist/cjs/CatchBoundary.d.cts +12 -0
  9. package/dist/cjs/ClientOnly.cjs +21 -0
  10. package/dist/cjs/ClientOnly.cjs.map +1 -0
  11. package/dist/cjs/ClientOnly.d.cts +49 -0
  12. package/dist/cjs/HeadContent.cjs +15 -0
  13. package/dist/cjs/HeadContent.cjs.map +1 -0
  14. package/dist/cjs/HeadContent.d.cts +6 -0
  15. package/dist/cjs/HeadContent.dev.cjs +41 -0
  16. package/dist/cjs/HeadContent.dev.cjs.map +1 -0
  17. package/dist/cjs/HeadContent.dev.d.cts +10 -0
  18. package/dist/cjs/Match.cjs +255 -0
  19. package/dist/cjs/Match.cjs.map +1 -0
  20. package/dist/cjs/Match.d.cts +14 -0
  21. package/dist/cjs/Matches.cjs +138 -0
  22. package/dist/cjs/Matches.cjs.map +1 -0
  23. package/dist/cjs/Matches.d.cts +68 -0
  24. package/dist/cjs/RouterProvider.cjs +32 -0
  25. package/dist/cjs/RouterProvider.cjs.map +1 -0
  26. package/dist/cjs/RouterProvider.d.cts +23 -0
  27. package/dist/cjs/SafeFragment.cjs +8 -0
  28. package/dist/cjs/SafeFragment.cjs.map +1 -0
  29. package/dist/cjs/SafeFragment.d.cts +1 -0
  30. package/dist/cjs/ScriptOnce.cjs +22 -0
  31. package/dist/cjs/ScriptOnce.cjs.map +1 -0
  32. package/dist/cjs/ScriptOnce.d.cts +6 -0
  33. package/dist/cjs/Scripts.cjs +56 -0
  34. package/dist/cjs/Scripts.cjs.map +1 -0
  35. package/dist/cjs/Scripts.d.cts +5 -0
  36. package/dist/cjs/ScrollRestoration.cjs +38 -0
  37. package/dist/cjs/ScrollRestoration.cjs.map +1 -0
  38. package/dist/cjs/ScrollRestoration.d.cts +14 -0
  39. package/dist/cjs/Transitioner.cjs +119 -0
  40. package/dist/cjs/Transitioner.cjs.map +1 -0
  41. package/dist/cjs/Transitioner.d.cts +1 -0
  42. package/dist/cjs/awaited.cjs +51 -0
  43. package/dist/cjs/awaited.cjs.map +1 -0
  44. package/dist/cjs/awaited.d.cts +14 -0
  45. package/dist/cjs/fileRoute.cjs +109 -0
  46. package/dist/cjs/fileRoute.cjs.map +1 -0
  47. package/dist/cjs/fileRoute.d.cts +87 -0
  48. package/dist/cjs/headContentUtils.cjs +185 -0
  49. package/dist/cjs/headContentUtils.cjs.map +1 -0
  50. package/dist/cjs/headContentUtils.d.cts +7 -0
  51. package/dist/cjs/history.d.cts +8 -0
  52. package/dist/cjs/index.cjs +241 -0
  53. package/dist/cjs/index.cjs.map +1 -0
  54. package/dist/cjs/index.d.cts +51 -0
  55. package/dist/cjs/index.dev.cjs +241 -0
  56. package/dist/cjs/index.dev.cjs.map +1 -0
  57. package/dist/cjs/index.dev.d.cts +2 -0
  58. package/dist/cjs/lazyRouteComponent.cjs +70 -0
  59. package/dist/cjs/lazyRouteComponent.cjs.map +1 -0
  60. package/dist/cjs/lazyRouteComponent.d.cts +11 -0
  61. package/dist/cjs/link.cjs +573 -0
  62. package/dist/cjs/link.cjs.map +1 -0
  63. package/dist/cjs/link.d.cts +98 -0
  64. package/dist/cjs/matchContext.cjs +27 -0
  65. package/dist/cjs/matchContext.cjs.map +1 -0
  66. package/dist/cjs/matchContext.d.cts +3 -0
  67. package/dist/cjs/not-found.cjs +38 -0
  68. package/dist/cjs/not-found.cjs.map +1 -0
  69. package/dist/cjs/not-found.d.cts +9 -0
  70. package/dist/cjs/renderRouteNotFound.cjs +22 -0
  71. package/dist/cjs/renderRouteNotFound.cjs.map +1 -0
  72. package/dist/cjs/renderRouteNotFound.d.cts +10 -0
  73. package/dist/cjs/route.cjs +198 -0
  74. package/dist/cjs/route.cjs.map +1 -0
  75. package/dist/cjs/route.d.cts +142 -0
  76. package/dist/cjs/router.cjs +22 -0
  77. package/dist/cjs/router.cjs.map +1 -0
  78. package/dist/cjs/router.d.cts +83 -0
  79. package/dist/cjs/routerContext.cjs +23 -0
  80. package/dist/cjs/routerContext.cjs.map +1 -0
  81. package/dist/cjs/routerContext.d.cts +3 -0
  82. package/dist/cjs/scroll-restoration.cjs +39 -0
  83. package/dist/cjs/scroll-restoration.cjs.map +1 -0
  84. package/dist/cjs/scroll-restoration.d.cts +1 -0
  85. package/dist/cjs/ssr/RouterClient.cjs +25 -0
  86. package/dist/cjs/ssr/RouterClient.cjs.map +1 -0
  87. package/dist/cjs/ssr/RouterClient.d.cts +4 -0
  88. package/dist/cjs/ssr/RouterServer.cjs +9 -0
  89. package/dist/cjs/ssr/RouterServer.cjs.map +1 -0
  90. package/dist/cjs/ssr/RouterServer.d.cts +4 -0
  91. package/dist/cjs/ssr/client.cjs +12 -0
  92. package/dist/cjs/ssr/client.cjs.map +1 -0
  93. package/dist/cjs/ssr/client.d.cts +2 -0
  94. package/dist/cjs/ssr/defaultRenderHandler.cjs +15 -0
  95. package/dist/cjs/ssr/defaultRenderHandler.cjs.map +1 -0
  96. package/dist/cjs/ssr/defaultRenderHandler.d.cts +1 -0
  97. package/dist/cjs/ssr/defaultStreamHandler.cjs +16 -0
  98. package/dist/cjs/ssr/defaultStreamHandler.cjs.map +1 -0
  99. package/dist/cjs/ssr/defaultStreamHandler.d.cts +1 -0
  100. package/dist/cjs/ssr/renderRouterToStream.cjs +73 -0
  101. package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -0
  102. package/dist/cjs/ssr/renderRouterToStream.d.cts +8 -0
  103. package/dist/cjs/ssr/renderRouterToString.cjs +31 -0
  104. package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -0
  105. package/dist/cjs/ssr/renderRouterToString.d.cts +7 -0
  106. package/dist/cjs/ssr/serializer.d.cts +6 -0
  107. package/dist/cjs/ssr/server.cjs +20 -0
  108. package/dist/cjs/ssr/server.cjs.map +1 -0
  109. package/dist/cjs/ssr/server.d.cts +6 -0
  110. package/dist/cjs/structuralSharing.d.cts +8 -0
  111. package/dist/cjs/typePrimitives.d.cts +16 -0
  112. package/dist/cjs/useBlocker.cjs +171 -0
  113. package/dist/cjs/useBlocker.cjs.map +1 -0
  114. package/dist/cjs/useBlocker.d.cts +66 -0
  115. package/dist/cjs/useCanGoBack.cjs +8 -0
  116. package/dist/cjs/useCanGoBack.cjs.map +1 -0
  117. package/dist/cjs/useCanGoBack.d.cts +1 -0
  118. package/dist/cjs/useLoaderData.cjs +15 -0
  119. package/dist/cjs/useLoaderData.cjs.map +1 -0
  120. package/dist/cjs/useLoaderData.d.cts +19 -0
  121. package/dist/cjs/useLoaderDeps.cjs +14 -0
  122. package/dist/cjs/useLoaderDeps.cjs.map +1 -0
  123. package/dist/cjs/useLoaderDeps.d.cts +19 -0
  124. package/dist/cjs/useLocation.cjs +10 -0
  125. package/dist/cjs/useLocation.cjs.map +1 -0
  126. package/dist/cjs/useLocation.d.cts +18 -0
  127. package/dist/cjs/useMatch.cjs +47 -0
  128. package/dist/cjs/useMatch.cjs.map +1 -0
  129. package/dist/cjs/useMatch.d.cts +14 -0
  130. package/dist/cjs/useNavigate.cjs +49 -0
  131. package/dist/cjs/useNavigate.cjs.map +1 -0
  132. package/dist/cjs/useNavigate.d.cts +28 -0
  133. package/dist/cjs/useParams.cjs +17 -0
  134. package/dist/cjs/useParams.cjs.map +1 -0
  135. package/dist/cjs/useParams.d.cts +21 -0
  136. package/dist/cjs/useRouteContext.cjs +11 -0
  137. package/dist/cjs/useRouteContext.cjs.map +1 -0
  138. package/dist/cjs/useRouteContext.d.cts +3 -0
  139. package/dist/cjs/useRouter.cjs +32 -0
  140. package/dist/cjs/useRouter.cjs.map +1 -0
  141. package/dist/cjs/useRouter.d.cts +14 -0
  142. package/dist/cjs/useRouterState.cjs +38 -0
  143. package/dist/cjs/useRouterState.cjs.map +1 -0
  144. package/dist/cjs/useRouterState.d.cts +20 -0
  145. package/dist/cjs/useSearch.cjs +16 -0
  146. package/dist/cjs/useSearch.cjs.map +1 -0
  147. package/dist/cjs/useSearch.d.cts +21 -0
  148. package/dist/cjs/utils.cjs +62 -0
  149. package/dist/cjs/utils.cjs.map +1 -0
  150. package/dist/cjs/utils.d.cts +54 -0
  151. package/dist/esm/Asset.d.ts +5 -0
  152. package/dist/esm/Asset.js +160 -0
  153. package/dist/esm/Asset.js.map +1 -0
  154. package/dist/esm/CatchBoundary.d.ts +12 -0
  155. package/dist/esm/CatchBoundary.js +97 -0
  156. package/dist/esm/CatchBoundary.js.map +1 -0
  157. package/dist/esm/ClientOnly.d.ts +49 -0
  158. package/dist/esm/ClientOnly.js +21 -0
  159. package/dist/esm/ClientOnly.js.map +1 -0
  160. package/dist/esm/HeadContent.d.ts +6 -0
  161. package/dist/esm/HeadContent.dev.d.ts +10 -0
  162. package/dist/esm/HeadContent.dev.js +25 -0
  163. package/dist/esm/HeadContent.dev.js.map +1 -0
  164. package/dist/esm/HeadContent.js +15 -0
  165. package/dist/esm/HeadContent.js.map +1 -0
  166. package/dist/esm/Match.d.ts +14 -0
  167. package/dist/esm/Match.js +238 -0
  168. package/dist/esm/Match.js.map +1 -0
  169. package/dist/esm/Matches.d.ts +68 -0
  170. package/dist/esm/Matches.js +121 -0
  171. package/dist/esm/Matches.js.map +1 -0
  172. package/dist/esm/RouterProvider.d.ts +23 -0
  173. package/dist/esm/RouterProvider.js +32 -0
  174. package/dist/esm/RouterProvider.js.map +1 -0
  175. package/dist/esm/SafeFragment.d.ts +1 -0
  176. package/dist/esm/SafeFragment.js +8 -0
  177. package/dist/esm/SafeFragment.js.map +1 -0
  178. package/dist/esm/ScriptOnce.d.ts +6 -0
  179. package/dist/esm/ScriptOnce.js +22 -0
  180. package/dist/esm/ScriptOnce.js.map +1 -0
  181. package/dist/esm/Scripts.d.ts +5 -0
  182. package/dist/esm/Scripts.js +56 -0
  183. package/dist/esm/Scripts.js.map +1 -0
  184. package/dist/esm/ScrollRestoration.d.ts +14 -0
  185. package/dist/esm/ScrollRestoration.js +38 -0
  186. package/dist/esm/ScrollRestoration.js.map +1 -0
  187. package/dist/esm/Transitioner.d.ts +1 -0
  188. package/dist/esm/Transitioner.js +102 -0
  189. package/dist/esm/Transitioner.js.map +1 -0
  190. package/dist/esm/awaited.d.ts +14 -0
  191. package/dist/esm/awaited.js +34 -0
  192. package/dist/esm/awaited.js.map +1 -0
  193. package/dist/esm/fileRoute.d.ts +87 -0
  194. package/dist/esm/fileRoute.js +109 -0
  195. package/dist/esm/fileRoute.js.map +1 -0
  196. package/dist/esm/headContentUtils.d.ts +7 -0
  197. package/dist/esm/headContentUtils.js +168 -0
  198. package/dist/esm/headContentUtils.js.map +1 -0
  199. package/dist/esm/history.d.ts +8 -0
  200. package/dist/esm/index.d.ts +51 -0
  201. package/dist/esm/index.dev.d.ts +2 -0
  202. package/dist/esm/index.dev.js +133 -0
  203. package/dist/esm/index.dev.js.map +1 -0
  204. package/dist/esm/index.js +133 -0
  205. package/dist/esm/index.js.map +1 -0
  206. package/dist/esm/lazyRouteComponent.d.ts +11 -0
  207. package/dist/esm/lazyRouteComponent.js +53 -0
  208. package/dist/esm/lazyRouteComponent.js.map +1 -0
  209. package/dist/esm/link.d.ts +98 -0
  210. package/dist/esm/link.js +556 -0
  211. package/dist/esm/link.js.map +1 -0
  212. package/dist/esm/matchContext.d.ts +3 -0
  213. package/dist/esm/matchContext.js +10 -0
  214. package/dist/esm/matchContext.js.map +1 -0
  215. package/dist/esm/not-found.d.ts +9 -0
  216. package/dist/esm/not-found.js +38 -0
  217. package/dist/esm/not-found.js.map +1 -0
  218. package/dist/esm/renderRouteNotFound.d.ts +10 -0
  219. package/dist/esm/renderRouteNotFound.js +22 -0
  220. package/dist/esm/renderRouteNotFound.js.map +1 -0
  221. package/dist/esm/route.d.ts +142 -0
  222. package/dist/esm/route.js +198 -0
  223. package/dist/esm/route.js.map +1 -0
  224. package/dist/esm/router.d.ts +83 -0
  225. package/dist/esm/router.js +22 -0
  226. package/dist/esm/router.js.map +1 -0
  227. package/dist/esm/routerContext.d.ts +3 -0
  228. package/dist/esm/routerContext.js +6 -0
  229. package/dist/esm/routerContext.js.map +1 -0
  230. package/dist/esm/scroll-restoration.d.ts +1 -0
  231. package/dist/esm/scroll-restoration.js +39 -0
  232. package/dist/esm/scroll-restoration.js.map +1 -0
  233. package/dist/esm/ssr/RouterClient.d.ts +4 -0
  234. package/dist/esm/ssr/RouterClient.js +25 -0
  235. package/dist/esm/ssr/RouterClient.js.map +1 -0
  236. package/dist/esm/ssr/RouterServer.d.ts +4 -0
  237. package/dist/esm/ssr/RouterServer.js +9 -0
  238. package/dist/esm/ssr/RouterServer.js.map +1 -0
  239. package/dist/esm/ssr/client.d.ts +2 -0
  240. package/dist/esm/ssr/client.js +6 -0
  241. package/dist/esm/ssr/client.js.map +1 -0
  242. package/dist/esm/ssr/defaultRenderHandler.d.ts +1 -0
  243. package/dist/esm/ssr/defaultRenderHandler.js +15 -0
  244. package/dist/esm/ssr/defaultRenderHandler.js.map +1 -0
  245. package/dist/esm/ssr/defaultStreamHandler.d.ts +1 -0
  246. package/dist/esm/ssr/defaultStreamHandler.js +16 -0
  247. package/dist/esm/ssr/defaultStreamHandler.js.map +1 -0
  248. package/dist/esm/ssr/renderRouterToStream.d.ts +8 -0
  249. package/dist/esm/ssr/renderRouterToStream.js +73 -0
  250. package/dist/esm/ssr/renderRouterToStream.js.map +1 -0
  251. package/dist/esm/ssr/renderRouterToString.d.ts +7 -0
  252. package/dist/esm/ssr/renderRouterToString.js +31 -0
  253. package/dist/esm/ssr/renderRouterToString.js.map +1 -0
  254. package/dist/esm/ssr/serializer.d.ts +6 -0
  255. package/dist/esm/ssr/server.d.ts +6 -0
  256. package/dist/esm/ssr/server.js +14 -0
  257. package/dist/esm/ssr/server.js.map +1 -0
  258. package/dist/esm/structuralSharing.d.ts +8 -0
  259. package/dist/esm/typePrimitives.d.ts +16 -0
  260. package/dist/esm/useBlocker.d.ts +66 -0
  261. package/dist/esm/useBlocker.js +154 -0
  262. package/dist/esm/useBlocker.js.map +1 -0
  263. package/dist/esm/useCanGoBack.d.ts +1 -0
  264. package/dist/esm/useCanGoBack.js +8 -0
  265. package/dist/esm/useCanGoBack.js.map +1 -0
  266. package/dist/esm/useLoaderData.d.ts +19 -0
  267. package/dist/esm/useLoaderData.js +15 -0
  268. package/dist/esm/useLoaderData.js.map +1 -0
  269. package/dist/esm/useLoaderDeps.d.ts +19 -0
  270. package/dist/esm/useLoaderDeps.js +14 -0
  271. package/dist/esm/useLoaderDeps.js.map +1 -0
  272. package/dist/esm/useLocation.d.ts +18 -0
  273. package/dist/esm/useLocation.js +10 -0
  274. package/dist/esm/useLocation.js.map +1 -0
  275. package/dist/esm/useMatch.d.ts +14 -0
  276. package/dist/esm/useMatch.js +30 -0
  277. package/dist/esm/useMatch.js.map +1 -0
  278. package/dist/esm/useNavigate.d.ts +28 -0
  279. package/dist/esm/useNavigate.js +32 -0
  280. package/dist/esm/useNavigate.js.map +1 -0
  281. package/dist/esm/useParams.d.ts +21 -0
  282. package/dist/esm/useParams.js +17 -0
  283. package/dist/esm/useParams.js.map +1 -0
  284. package/dist/esm/useRouteContext.d.ts +3 -0
  285. package/dist/esm/useRouteContext.js +11 -0
  286. package/dist/esm/useRouteContext.js.map +1 -0
  287. package/dist/esm/useRouter.d.ts +14 -0
  288. package/dist/esm/useRouter.js +15 -0
  289. package/dist/esm/useRouter.js.map +1 -0
  290. package/dist/esm/useRouterState.d.ts +20 -0
  291. package/dist/esm/useRouterState.js +38 -0
  292. package/dist/esm/useRouterState.js.map +1 -0
  293. package/dist/esm/useSearch.d.ts +21 -0
  294. package/dist/esm/useSearch.js +16 -0
  295. package/dist/esm/useSearch.js.map +1 -0
  296. package/dist/esm/utils.d.ts +54 -0
  297. package/dist/esm/utils.js +45 -0
  298. package/dist/esm/utils.js.map +1 -0
  299. package/dist/llms/index.d.ts +3 -0
  300. package/dist/llms/index.js +43 -0
  301. package/dist/llms/rules/api.d.ts +2 -0
  302. package/dist/llms/rules/api.js +4612 -0
  303. package/dist/llms/rules/guide.d.ts +2 -0
  304. package/dist/llms/rules/guide.js +10690 -0
  305. package/dist/llms/rules/installation.d.ts +2 -0
  306. package/dist/llms/rules/installation.js +1285 -0
  307. package/dist/llms/rules/routing.d.ts +2 -0
  308. package/dist/llms/rules/routing.js +1984 -0
  309. package/dist/llms/rules/setup-and-architecture.d.ts +2 -0
  310. package/dist/llms/rules/setup-and-architecture.js +920 -0
  311. package/package.json +142 -0
  312. package/src/Asset.tsx +219 -0
  313. package/src/CatchBoundary.tsx +120 -0
  314. package/src/ClientOnly.tsx +68 -0
  315. package/src/HeadContent.dev.tsx +46 -0
  316. package/src/HeadContent.tsx +22 -0
  317. package/src/Match.tsx +360 -0
  318. package/src/Matches.tsx +313 -0
  319. package/src/RouterProvider.tsx +92 -0
  320. package/src/SafeFragment.tsx +5 -0
  321. package/src/ScriptOnce.tsx +21 -0
  322. package/src/Scripts.tsx +80 -0
  323. package/src/ScrollRestoration.tsx +69 -0
  324. package/src/Transitioner.tsx +134 -0
  325. package/src/awaited.tsx +55 -0
  326. package/src/fileRoute.ts +313 -0
  327. package/src/headContentUtils.tsx +217 -0
  328. package/src/history.ts +9 -0
  329. package/src/index.dev.tsx +6 -0
  330. package/src/index.tsx +341 -0
  331. package/src/lazyRouteComponent.tsx +96 -0
  332. package/src/link.tsx +984 -0
  333. package/src/matchContext.tsx +8 -0
  334. package/src/not-found.tsx +43 -0
  335. package/src/renderRouteNotFound.tsx +35 -0
  336. package/src/route.tsx +740 -0
  337. package/src/router.ts +127 -0
  338. package/src/routerContext.tsx +4 -0
  339. package/src/scroll-restoration.tsx +45 -0
  340. package/src/ssr/RouterClient.tsx +22 -0
  341. package/src/ssr/RouterServer.tsx +9 -0
  342. package/src/ssr/client.ts +2 -0
  343. package/src/ssr/defaultRenderHandler.tsx +12 -0
  344. package/src/ssr/defaultStreamHandler.tsx +13 -0
  345. package/src/ssr/renderRouterToStream.tsx +90 -0
  346. package/src/ssr/renderRouterToString.tsx +36 -0
  347. package/src/ssr/serializer.ts +7 -0
  348. package/src/ssr/server.ts +6 -0
  349. package/src/structuralSharing.ts +47 -0
  350. package/src/typePrimitives.ts +84 -0
  351. package/src/useBlocker.tsx +320 -0
  352. package/src/useCanGoBack.ts +5 -0
  353. package/src/useLoaderData.tsx +91 -0
  354. package/src/useLoaderDeps.tsx +69 -0
  355. package/src/useLocation.tsx +52 -0
  356. package/src/useMatch.tsx +123 -0
  357. package/src/useNavigate.tsx +78 -0
  358. package/src/useParams.tsx +107 -0
  359. package/src/useRouteContext.ts +30 -0
  360. package/src/useRouter.tsx +25 -0
  361. package/src/useRouterState.tsx +86 -0
  362. package/src/useSearch.tsx +105 -0
  363. package/src/utils.ts +125 -0
@@ -0,0 +1,1285 @@
1
+ export default `# Manual Setup
2
+
3
+ To set up TanStack Router manually in a React project, follow the steps below. This gives you a bare minimum setup to get going with TanStack Router using both file-based route generation and code-based route configuration:
4
+
5
+ ## Using File-Based Route Generation
6
+
7
+ #### Install TanStack Router, Vite Plugin, and the Router Devtools
8
+
9
+ Install the necessary core dependencies:
10
+
11
+ <!-- ::start:tabs variant="package-managers" -->
12
+
13
+ react: @tanstack/react-router @tanstack/react-router-devtools
14
+ solid: @tanstack/solid-router @tanstack/solid-router-devtools
15
+
16
+ <!-- ::end:tabs -->
17
+
18
+ Install the necessary development dependencies:
19
+
20
+ <!-- ::start:tabs variant="package-managers" mode="dev-install" -->
21
+
22
+ react: @tanstack/router-plugin
23
+ solid: @tanstack/router-plugin
24
+
25
+ <!-- ::end:tabs -->
26
+
27
+ #### Configure the Vite Plugin
28
+
29
+ \`\`\`tsx
30
+ // vite.config.ts
31
+ import { defineConfig } from 'vite'
32
+ import react from '@vitejs/plugin-react'
33
+ import { tanstackRouter } from '@tanstack/router-plugin/vite'
34
+
35
+ // https://vitejs.dev/config/
36
+ export default defineConfig({
37
+ plugins: [
38
+ // Please make sure that '@tanstack/router-plugin' is passed before '@vitejs/plugin-react'
39
+ tanstackRouter({
40
+ target: 'react',
41
+ autoCodeSplitting: true,
42
+ }),
43
+ react(),
44
+ // ...,
45
+ ],
46
+ })
47
+ \`\`\`
48
+
49
+ > [!TIP]
50
+ > If you are not using Vite, or any of the supported bundlers, you can check out the [TanStack Router CLI](./with-router-cli) guide for more info.
51
+
52
+ Create the following files:
53
+
54
+ - \`src/routes/__root.tsx\` (with two '\`_\`' characters)
55
+ - \`src/routes/index.tsx\`
56
+ - \`src/routes/about.tsx\`
57
+ - \`src/main.tsx\`
58
+
59
+ <!-- ::start:framework -->
60
+
61
+ # React
62
+
63
+ <!-- ::start:tabs variant="files" -->
64
+
65
+ \`\`\`tsx title="src/routes/__root.tsx"
66
+ import { createRootRoute, Link, Outlet } from '@tanstack/react-router'
67
+ import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
68
+
69
+ const RootLayout = () => (
70
+ <>
71
+ <div className="p-2 flex gap-2">
72
+ <Link to="/" className="[&.active]:font-bold">
73
+ Home
74
+ </Link>{' '}
75
+ <Link to="/about" className="[&.active]:font-bold">
76
+ About
77
+ </Link>
78
+ </div>
79
+ <hr />
80
+ <Outlet />
81
+ <TanStackRouterDevtools />
82
+ </>
83
+ )
84
+
85
+ export const Route = createRootRoute({ component: RootLayout })
86
+ \`\`\`
87
+
88
+ \`\`\`tsx title="src/routes/index.tsx"
89
+ import { createFileRoute } from '@tanstack/react-router'
90
+
91
+ export const Route = createFileRoute('/')({
92
+ component: Index,
93
+ })
94
+
95
+ function Index() {
96
+ return (
97
+ <div className="p-2">
98
+ <h3>Welcome Home!</h3>
99
+ </div>
100
+ )
101
+ }
102
+ \`\`\`
103
+
104
+ \`\`\`tsx title="src/routes/about.tsx"
105
+ import { createFileRoute } from '@tanstack/react-router'
106
+
107
+ export const Route = createFileRoute('/about')({
108
+ component: About,
109
+ })
110
+
111
+ function About() {
112
+ return <div className="p-2">Hello from About!</div>
113
+ }
114
+ \`\`\`
115
+
116
+ \`\`\`tsx title="src/main.tsx"
117
+ import { StrictMode } from 'react'
118
+ import ReactDOM from 'react-dom/client'
119
+ import { RouterProvider, createRouter } from '@tanstack/react-router'
120
+
121
+ // Import the generated route tree
122
+ import { routeTree } from './routeTree.gen'
123
+
124
+ // Create a new router instance
125
+ const router = createRouter({ routeTree })
126
+
127
+ // Register the router instance for type safety
128
+ declare module '@tanstack/react-router' {
129
+ interface Register {
130
+ router: typeof router
131
+ }
132
+ }
133
+
134
+ // Render the app
135
+ const rootElement = document.getElementById('root')!
136
+ if (!rootElement.innerHTML) {
137
+ const root = ReactDOM.createRoot(rootElement)
138
+ root.render(
139
+ <StrictMode>
140
+ <RouterProvider router={router} />
141
+ </StrictMode>,
142
+ )
143
+ }
144
+ \`\`\`
145
+
146
+ <!-- ::end:tabs -->
147
+
148
+ # Solid
149
+
150
+ <!-- ::start:tabs variant="files" -->
151
+
152
+ \`\`\`tsx title="src/routes/__root.tsx"
153
+ import { createRootRoute, Link, Outlet } from '@tanstack/solid-router'
154
+ import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
155
+
156
+ const RootLayout = () => (
157
+ <>
158
+ <div class="p-2 flex gap-2">
159
+ <Link to="/" class="[&.active]:font-bold">
160
+ Home
161
+ </Link>{' '}
162
+ <Link to="/about" class="[&.active]:font-bold">
163
+ About
164
+ </Link>
165
+ </div>
166
+ <hr />
167
+ <Outlet />
168
+ <TanStackRouterDevtools />
169
+ </>
170
+ )
171
+
172
+ export const Route = createRootRoute({ component: RootLayout })
173
+ \`\`\`
174
+
175
+ \`\`\`tsx title="src/routes/index.tsx"
176
+ import { createFileRoute } from '@tanstack/solid-router'
177
+
178
+ export const Route = createFileRoute('/')({
179
+ component: Index,
180
+ })
181
+
182
+ function Index() {
183
+ return (
184
+ <div class="p-2">
185
+ <h3>Welcome Home!</h3>
186
+ </div>
187
+ )
188
+ }
189
+ \`\`\`
190
+
191
+ \`\`\`tsx title="src/routes/about.tsx"
192
+ import { createFileRoute } from '@tanstack/solid-router'
193
+
194
+ export const Route = createFileRoute('/about')({
195
+ component: About,
196
+ })
197
+
198
+ function About() {
199
+ return <div class="p-2">Hello from About!</div>
200
+ }
201
+ \`\`\`
202
+
203
+ \`\`\`tsx title="src/main.tsx"
204
+ /* @refresh reload */
205
+ import { render } from 'solid-js/web'
206
+ import { RouterProvider, createRouter } from '@tanstack/solid-router'
207
+
208
+ // Import the generated route tree
209
+ import { routeTree } from './routeTree.gen'
210
+
211
+ // Create a new router instance
212
+ const router = createRouter({ routeTree })
213
+
214
+ // Register the router instance for type safety
215
+ declare module '@tanstack/solid-router' {
216
+ interface Register {
217
+ router: typeof router
218
+ }
219
+ }
220
+
221
+ // Render the app
222
+ const rootElement = document.getElementById('root')!
223
+
224
+ render(() => <RouterProvider router={router} />, rootElement)
225
+ \`\`\`
226
+
227
+ <!-- ::end:tabs -->
228
+
229
+ <!-- ::end:framework -->
230
+
231
+ Regardless of whether you are using the \`@tanstack/router-plugin\` package and running the \`npm run dev\`/\`npm run build\` scripts, or manually running the \`tsr watch\`/\`tsr generate\` commands from your package scripts, the route tree file will be generated at \`src/routeTree.gen.ts\`.
232
+
233
+ If you are working with this pattern you should change the \`id\` of the root \`<div>\` on your \`index.html\` file to \`<div id='root'></div>\`
234
+
235
+ ## Using Code-Based Route Configuration
236
+
237
+ > [!IMPORTANT]
238
+ > The following example shows how to configure routes using code, and for simplicity's sake is in a single file for this demo. While code-based generation allows you to declare many routes and even the router instance in a single file, we recommend splitting your routes into separate files for better organization and performance as your application grows.
239
+
240
+ <!-- ::start:framework -->
241
+
242
+ # React
243
+
244
+ \`\`\`tsx
245
+ import { StrictMode } from 'react'
246
+ import ReactDOM from 'react-dom/client'
247
+ import {
248
+ Outlet,
249
+ RouterProvider,
250
+ Link,
251
+ createRouter,
252
+ createRoute,
253
+ createRootRoute,
254
+ } from '@tanstack/react-router'
255
+ import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
256
+
257
+ const rootRoute = createRootRoute({
258
+ component: () => (
259
+ <>
260
+ <div className="p-2 flex gap-2">
261
+ <Link to="/" className="[&.active]:font-bold">
262
+ Home
263
+ </Link>{' '}
264
+ <Link to="/about" className="[&.active]:font-bold">
265
+ About
266
+ </Link>
267
+ </div>
268
+ <hr />
269
+ <Outlet />
270
+ <TanStackRouterDevtools />
271
+ </>
272
+ ),
273
+ })
274
+
275
+ const indexRoute = createRoute({
276
+ getParentRoute: () => rootRoute,
277
+ path: '/',
278
+ component: function Index() {
279
+ return (
280
+ <div className="p-2">
281
+ <h3>Welcome Home!</h3>
282
+ </div>
283
+ )
284
+ },
285
+ })
286
+
287
+ const aboutRoute = createRoute({
288
+ getParentRoute: () => rootRoute,
289
+ path: '/about',
290
+ component: function About() {
291
+ return <div className="p-2">Hello from About!</div>
292
+ },
293
+ })
294
+
295
+ const routeTree = rootRoute.addChildren([indexRoute, aboutRoute])
296
+
297
+ const router = createRouter({ routeTree })
298
+
299
+ declare module '@tanstack/react-router' {
300
+ interface Register {
301
+ router: typeof router
302
+ }
303
+ }
304
+
305
+ const rootElement = document.getElementById('app')!
306
+ if (!rootElement.innerHTML) {
307
+ const root = ReactDOM.createRoot(rootElement)
308
+ root.render(
309
+ <StrictMode>
310
+ <RouterProvider router={router} />
311
+ </StrictMode>,
312
+ )
313
+ }
314
+ \`\`\`
315
+
316
+ # Solid
317
+
318
+ \`\`\`tsx
319
+ /* @refresh reload */
320
+ import { render } from 'solid-js/web'
321
+ import {
322
+ Outlet,
323
+ RouterProvider,
324
+ Link,
325
+ createRouter,
326
+ createRoute,
327
+ createRootRoute,
328
+ } from '@tanstack/solid-router'
329
+ import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
330
+
331
+ const rootRoute = createRootRoute({
332
+ component: () => (
333
+ <>
334
+ <div class="p-2 flex gap-2">
335
+ <Link to="/" class="[&.active]:font-bold">
336
+ Home
337
+ </Link>{' '}
338
+ <Link to="/about" class="[&.active]:font-bold">
339
+ About
340
+ </Link>
341
+ </div>
342
+ <hr />
343
+ <Outlet />
344
+ <TanStackRouterDevtools />
345
+ </>
346
+ ),
347
+ })
348
+
349
+ const indexRoute = createRoute({
350
+ getParentRoute: () => rootRoute,
351
+ path: '/',
352
+ component: function Index() {
353
+ return (
354
+ <div class="p-2">
355
+ <h3>Welcome Home!</h3>
356
+ </div>
357
+ )
358
+ },
359
+ })
360
+
361
+ const aboutRoute = createRoute({
362
+ getParentRoute: () => rootRoute,
363
+ path: '/about',
364
+ component: function About() {
365
+ return <div class="p-2">Hello from About!</div>
366
+ },
367
+ })
368
+
369
+ const routeTree = rootRoute.addChildren([indexRoute, aboutRoute])
370
+
371
+ const router = createRouter({ routeTree })
372
+
373
+ declare module '@tanstack/solid-router' {
374
+ interface Register {
375
+ router: typeof router
376
+ }
377
+ }
378
+
379
+ const rootElement = document.getElementById('app')!
380
+ render(() => <RouterProvider router={router} />, rootElement)
381
+ \`\`\`
382
+
383
+ <!-- ::end:framework -->
384
+
385
+ If you glossed over these examples or didn't understand something, we don't blame you, because there's so much more to learn to really take advantage of TanStack Router! Let's move on.
386
+
387
+ # Migration from React Location
388
+
389
+ Before you begin your journey in migrating from React Location, it's important that you have a good understanding of the [Routing Concepts](../routing/routing-concepts.md) and [Design Decisions](../decisions-on-dx.md) used by TanStack Router.
390
+
391
+ ## Differences between React Location and TanStack Router
392
+
393
+ React Location and TanStack Router share much of same design decisions concepts, but there are some key differences that you should be aware of.
394
+
395
+ - React Location uses _generics_ to infer types for routes, while TanStack Router uses _module declaration merging_ to infer types.
396
+ - Route configuration in React Location is done using a single array of route definitions, while in TanStack Router, route configuration is done using a tree of route definitions starting with the [root route](../routing/routing-concepts.md#the-root-route).
397
+ - [File-based routing](../routing/file-based-routing.md) is the recommended way to define routes in TanStack Router, while React Location only allows you to define routes in a single file using a code-based approach.
398
+ - TanStack Router does support a [code-based approach](../routing/code-based-routing.md) to defining routes, but it is not recommended for most use cases. You can read more about why, over here: [why is file-based routing the preferred way to define routes?](../decisions-on-dx.md#why-is-file-based-routing-the-preferred-way-to-define-routes)
399
+
400
+ ## Migration guide
401
+
402
+ In this guide we'll go over the process of migrating the [React Location Basic example](https://github.com/TanStack/router/tree/react-location/examples/basic) over to TanStack Router using file-based routing, with the end goal of having the same functionality as the original example (styling and other non-routing related code will be omitted).
403
+
404
+ > [!TIP]
405
+ > To use a code-based approach for defining your routes, you can read the [code-based Routing](../routing/code-based-routing.md) guide.
406
+
407
+ ### Step 1: Swap over to TanStack Router's dependencies
408
+
409
+ First, we need to install the dependencies for TanStack Router. For detailed installation instructions, see our [How to Install TanStack Router](../how-to/install.md) guide.
410
+
411
+ \`\`\`sh
412
+ npm install @tanstack/react-router @tanstack/router-devtools
413
+ \`\`\`
414
+
415
+ And remove the React Location dependencies.
416
+
417
+ \`\`\`sh
418
+ npm uninstall @tanstack/react-location @tanstack/react-location-devtools
419
+ \`\`\`
420
+
421
+ ### Step 2: Use the file-based routing watcher
422
+
423
+ If your project uses Vite (or one of the supported bundlers), you can use the TanStack Router plugin to watch for changes in your routes files and automatically update the routes configuration.
424
+
425
+ Installation of the Vite plugin:
426
+
427
+ \`\`\`sh
428
+ npm install -D @tanstack/router-plugin
429
+ \`\`\`
430
+
431
+ And add it to your \`vite.config.js\`:
432
+
433
+ \`\`\`js
434
+ import { defineConfig } from 'vite'
435
+ import react from '@vitejs/plugin-react'
436
+ import { tanstackRouter } from '@tanstack/router-plugin/vite'
437
+
438
+ export default defineConfig({
439
+ // ...
440
+ plugins: [tanstackRouter(), react()],
441
+ })
442
+ \`\`\`
443
+
444
+ However, if your application does not use Vite, you use one of our other [supported bundlers](../routing/file-based-routing.md#getting-started-with-file-based-routing), or you can use the \`@tanstack/router-cli\` package to watch for changes in your routes files and automatically update the routes configuration.
445
+
446
+ ### Step 3: Add the file-based configuration file to your project
447
+
448
+ Create a \`tsr.config.json\` file in the root of your project with the following content:
449
+
450
+ \`\`\`json
451
+ {
452
+ "routesDirectory": "./src/routes",
453
+ "generatedRouteTree": "./src/routeTree.gen.ts"
454
+ }
455
+ \`\`\`
456
+
457
+ You can find the full list of options for the \`tsr.config.json\` file in the [File-Based Routing](../routing/file-based-routing.md) guide.
458
+
459
+ ### Step 4: Create the routes directory
460
+
461
+ Create a \`routes\` directory in the \`src\` directory of your project.
462
+
463
+ \`\`\`sh
464
+ mkdir src/routes
465
+ \`\`\`
466
+
467
+ ### Step 5: Create the root route file
468
+
469
+ \`\`\`tsx
470
+ // src/routes/__root.tsx
471
+ import { createRootRoute, Outlet, Link } from '@tanstack/react-router'
472
+ import { TanStackRouterDevtools } from '@tanstack/router-devtools'
473
+
474
+ export const Route = createRootRoute({
475
+ component: () => {
476
+ return (
477
+ <>
478
+ <div>
479
+ <Link to="/" activeOptions={{ exact: true }}>
480
+ Home
481
+ </Link>
482
+ <Link to="/posts">Posts</Link>
483
+ </div>
484
+ <hr />
485
+ <Outlet />
486
+ <TanStackRouterDevtools />
487
+ </>
488
+ )
489
+ },
490
+ })
491
+ \`\`\`
492
+
493
+ ### Step 6: Create the index route file
494
+
495
+ \`\`\`tsx
496
+ // src/routes/index.tsx
497
+ import { createFileRoute } from '@tanstack/react-router'
498
+
499
+ export const Route = createFileRoute('/')({
500
+ component: Index,
501
+ })
502
+ \`\`\`
503
+
504
+ > You will need to move any related components and logic needed for the index route from the \`src/index.tsx\` file to the \`src/routes/index.tsx\` file.
505
+
506
+ ### Step 7: Create the posts route file
507
+
508
+ \`\`\`tsx
509
+ // src/routes/posts.tsx
510
+ import { createFileRoute, Link, Outlet } from '@tanstack/react-router'
511
+
512
+ export const Route = createFileRoute('/posts')({
513
+ component: Posts,
514
+ loader: async () => {
515
+ const posts = await fetchPosts()
516
+ return {
517
+ posts,
518
+ }
519
+ },
520
+ })
521
+
522
+ function Posts() {
523
+ const { posts } = Route.useLoaderData()
524
+ return (
525
+ <div>
526
+ <nav>
527
+ {posts.map((post) => (
528
+ <Link
529
+ key={post.id}
530
+ to={\`/posts/$postId\`}
531
+ params={{ postId: post.id }}
532
+ >
533
+ {post.title}
534
+ </Link>
535
+ ))}
536
+ </nav>
537
+ <Outlet />
538
+ </div>
539
+ )
540
+ }
541
+ \`\`\`
542
+
543
+ > You will need to move any related components and logic needed for the posts route from the \`src/index.tsx\` file to the \`src/routes/posts.tsx\` file.
544
+
545
+ ### Step 8: Create the posts index route file
546
+
547
+ \`\`\`tsx
548
+ // src/routes/posts.index.tsx
549
+ import { createFileRoute } from '@tanstack/react-router'
550
+
551
+ export const Route = createFileRoute('/posts/')({
552
+ component: PostsIndex,
553
+ })
554
+ \`\`\`
555
+
556
+ > You will need to move any related components and logic needed for the posts index route from the \`src/index.tsx\` file to the \`src/routes/posts.index.tsx\` file.
557
+
558
+ ### Step 9: Create the posts id route file
559
+
560
+ \`\`\`tsx
561
+ // src/routes/posts.$postId.tsx
562
+ import { createFileRoute } from '@tanstack/react-router'
563
+
564
+ export const Route = createFileRoute('/posts/$postId')({
565
+ component: PostsId,
566
+ loader: async ({ params: { postId } }) => {
567
+ const post = await fetchPost(postId)
568
+ return {
569
+ post,
570
+ }
571
+ },
572
+ })
573
+
574
+ function PostsId() {
575
+ const { post } = Route.useLoaderData()
576
+ // ...
577
+ }
578
+ \`\`\`
579
+
580
+ > You will need to move any related components and logic needed for the posts id route from the \`src/index.tsx\` file to the \`src/routes/posts.$postId.tsx\` file.
581
+
582
+ ### Step 10: Generate the route tree
583
+
584
+ If you are using one of the supported bundlers, the route tree will be generated automatically when you run the dev script.
585
+
586
+ If you are not using one of the supported bundlers, you can generate the route tree by running the following command:
587
+
588
+ \`\`\`sh
589
+ npx tsr generate
590
+ \`\`\`
591
+
592
+ ### Step 11: Update the main entry file to render the Router
593
+
594
+ Once you've generated the route-tree, you can then update the \`src/index.tsx\` file to create the router instance and render it.
595
+
596
+ \`\`\`tsx
597
+ // src/index.tsx
598
+ import React from 'react'
599
+ import ReactDOM from 'react-dom'
600
+ import { createRouter, RouterProvider } from '@tanstack/react-router'
601
+
602
+ // Import the generated route tree
603
+ import { routeTree } from './routeTree.gen'
604
+
605
+ // Create a new router instance
606
+ const router = createRouter({ routeTree })
607
+
608
+ // Register the router instance for type safety
609
+ declare module '@tanstack/react-router' {
610
+ interface Register {
611
+ router: typeof router
612
+ }
613
+ }
614
+
615
+ const domElementId = 'root' // Assuming you have a root element with the id 'root'
616
+
617
+ // Render the app
618
+ const rootElement = document.getElementById(domElementId)
619
+ if (!rootElement) {
620
+ throw new Error(\`Element with id \${domElementId} not found\`)
621
+ }
622
+
623
+ ReactDOM.createRoot(rootElement).render(
624
+ <React.StrictMode>
625
+ <RouterProvider router={router} />
626
+ </React.StrictMode>,
627
+ )
628
+ \`\`\`
629
+
630
+ ### Finished!
631
+
632
+ You should now have successfully migrated your application from React Location to TanStack Router using file-based routing.
633
+
634
+ React Location also has a few more features that you might be using in your application. Here are some guides to help you migrate those features:
635
+
636
+ - [Search params](../guide/search-params.md)
637
+ - [Data loading](../guide/data-loading.md)
638
+ - [History types](../guide/history-types.md)
639
+ - [Wildcard / Splat / Catch-all routes](../routing/routing-concepts.md#splat--catch-all-routes)
640
+ - [Authenticated routes](../guide/authenticated-routes.md)
641
+
642
+ TanStack Router also has a few more features that you might want to explore:
643
+
644
+ - [Router Context](../guide/router-context.md)
645
+ - [Preloading](../guide/preloading.md)
646
+ - [Pathless Layout Routes](../routing/routing-concepts.md#pathless-layout-routes)
647
+ - [Route masking](../guide/route-masking.md)
648
+ - [SSR](../guide/ssr.md)
649
+ - ... and more!
650
+
651
+ If you are facing any issues or have any questions, feel free to ask for help in the TanStack Discord.
652
+
653
+ # Migration from React Router Checklist
654
+
655
+ **_If your UI is blank, open the console, and you will probably have some errors that read something along the lines of \`cannot use 'useNavigate' outside of context\` . This means there are React Router api’s that are still imported and referenced that you need to find and remove. The easiest way to make sure you find all React Router imports is to uninstall \`react-router-dom\` and then you should get typescript errors in your files. Then you will know what to change to a \`@tanstack/react-router\` import._**
656
+
657
+ Here is the [example repo](https://github.com/Benanna2019/SickFitsForEveryone/tree/migrate-to-tanstack/router/React-Router)
658
+
659
+ - [ ] Install Router - \`npm i @tanstack/react-router\` (see [detailed installation guide](../how-to/install.md))
660
+ - [ ] **Optional:** Uninstall React Router to get TypeScript errors on imports.
661
+ - At this point I don’t know if you can do a gradual migration, but it seems likely you could have multiple router providers, not desirable.
662
+ - The api’s between React Router and TanStack Router are very similar and could most likely be handled in a sprint cycle or two if that is your companies way of doing things.
663
+ - [ ] Create Routes for each existing React Router route we have
664
+ - [ ] Create root route
665
+ - [ ] Create router instance
666
+ - [ ] Add global module in main.tsx
667
+ - [ ] Remove any React Router (\`createBrowserRouter\` or \`BrowserRouter\`), \`Routes\`, and \`Route\` Components from main.tsx
668
+ - [ ] **Optional:** Refactor \`render\` function for custom setup/providers - The repo referenced above has an example - This was necessary in the case of Supertokens. Supertoken has a specific setup with React Router and a different setup with all other React implementations
669
+ - [ ] Set RouterProvider and pass it the router as the prop
670
+ - [ ] Replace all instances of React Router \`Link\` component with \`@tanstack/react-router\` \`Link\` component
671
+ - [ ] Add \`to\` prop with literal path
672
+ - [ ] Add \`params\` prop, where necessary with params like so \`params={{ orderId: order.id }}\`
673
+ - [ ] Replace all instances of React Router \`useNavigate\` hook with \`@tanstack/react-router\` \`useNavigate\` hook
674
+ - [ ] Set \`to\` property and \`params\` property where needed
675
+ - [ ] Replace any React Router \`Outlet\`'s with the \`@tanstack/react-router\` equivalent
676
+ - [ ] If you are using \`useSearchParams\` hook from React Router, move the search params default value to the validateSearch property on a Route definition.
677
+ - [ ] Instead of using the \`useSearchParams\` hook, use \`@tanstack/react-router\` \`Link\`'s search property to update the search params state
678
+ - [ ] To read search params you can do something like the following
679
+ - \`const { page } = useSearch({ from: productPage.fullPath })\`
680
+ - [ ] If using React Router’s \`useParams\` hook, update the import to be from \`@tanstack/react-router\` and set the \`from\` property to the literal path name where you want to read the params object from
681
+ - So say we have a route with the path name \`orders/$orderid\`.
682
+ - In the \`useParams\` hook we would set up our hook like so: \`const params = useParams({ from: "/orders/$orderId" })\`
683
+ - Then wherever we wanted to access the order id we would get it off of the params object \`params.orderId\`
684
+
685
+ # Installation with Esbuild
686
+
687
+ To use file-based routing with **Esbuild**, you'll need to install the \`@tanstack/router-plugin\` package.
688
+
689
+ <!-- ::start:tabs variant="package-manager" mode="dev-install" -->
690
+
691
+ react: @tanstack/router-plugin
692
+ solid: @tanstack/router-plugin
693
+
694
+ <!-- ::end:tabs -->
695
+
696
+ Once installed, you'll need to add the plugin to your configuration.
697
+
698
+ <!-- ::start:framework -->
699
+
700
+ # React
701
+
702
+ \`\`\`ts title="esbuild.config.js"
703
+ import { tanstackRouter } from '@tanstack/router-plugin/esbuild'
704
+
705
+ export default {
706
+ // ...
707
+ plugins: [
708
+ tanstackRouter({
709
+ target: 'react',
710
+ autoCodeSplitting: true,
711
+ }),
712
+ ],
713
+ }
714
+ \`\`\`
715
+
716
+ Or, you can clone our [Quickstart Esbuild example](https://github.com/TanStack/router/tree/main/examples/react/quickstart-esbuild-file-based) and get started.
717
+
718
+ # Solid
719
+
720
+ \`\`\`ts title="build.js"
721
+ import * as esbuild from 'esbuild'
722
+ import { solidPlugin } from 'esbuild-plugin-solid'
723
+ import { tanstackRouter } from '@tanstack/router-plugin/esbuild'
724
+
725
+ const isDev = process.argv.includes('--dev')
726
+
727
+ const ctx = await esbuild.context({
728
+ entryPoints: ['src/main.tsx'],
729
+ outfile: 'dist/main.js',
730
+ minify: !isDev,
731
+ bundle: true,
732
+ format: 'esm',
733
+ target: ['esnext'],
734
+ sourcemap: true,
735
+ plugins: [
736
+ solidPlugin(),
737
+ tanstackRouter({ target: 'solid', autoCodeSplitting: true }),
738
+ ],
739
+ })
740
+
741
+ if (isDev) {
742
+ await ctx.watch()
743
+ const { host, port } = await ctx.serve({ servedir: '.', port: 3005 })
744
+ console.log(\`Server running at http://\${host || 'localhost'}:\${port}\`)
745
+ } else {
746
+ await ctx.rebuild()
747
+ await ctx.dispose()
748
+ }
749
+ \`\`\`
750
+
751
+ Or, you can clone our [Quickstart Esbuild example](https://github.com/TanStack/router/tree/main/examples/solid/quickstart-esbuild-file-based) and get started.
752
+
753
+ <!-- ::end:framework -->
754
+
755
+ Now that you've added the plugin to your Esbuild configuration, you're all set to start using file-based routing with TanStack Router.
756
+
757
+ ## Ignoring the generated route tree file
758
+
759
+ If your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.
760
+
761
+ Here are some resources to help you ignore the generated route tree file:
762
+
763
+ - Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)
764
+ - ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)
765
+ - Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)
766
+
767
+ > [!WARNING]
768
+ > If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.
769
+
770
+ You can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:
771
+
772
+ \`\`\`json
773
+ {
774
+ "files.readonlyInclude": {
775
+ "**/routeTree.gen.ts": true
776
+ },
777
+ "files.watcherExclude": {
778
+ "**/routeTree.gen.ts": true
779
+ },
780
+ "search.exclude": {
781
+ "**/routeTree.gen.ts": true
782
+ }
783
+ }
784
+ \`\`\`
785
+
786
+ You can use those settings either at a user level or only for a single workspace by creating the file \`.vscode/settings.json\` at the root of your project.
787
+
788
+ ## Configuration
789
+
790
+ When using the TanStack Router Plugin with Esbuild for File-based routing, it comes with some sane defaults that should work for most projects:
791
+
792
+ \`\`\`json
793
+ {
794
+ "routesDirectory": "./src/routes",
795
+ "generatedRouteTree": "./src/routeTree.gen.ts",
796
+ "routeFileIgnorePrefix": "-",
797
+ "quoteStyle": "single"
798
+ }
799
+ \`\`\`
800
+
801
+ If these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by editing the configuration object passed into the \`tanstackRouter\` function.
802
+
803
+ You can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).
804
+
805
+ # Installation with Router CLI
806
+
807
+ > [!WARNING]
808
+ > You should only use the TanStack Router CLI if you are not using a supported bundler. The CLI only supports the generation of the route tree file and does not provide any other features.
809
+
810
+ To use file-based routing with the TanStack Router CLI, you'll need to install the \`@tanstack/router-cli\` package.
811
+
812
+ <!-- ::start:tabs variant="package-manager" mode="dev-install" -->
813
+
814
+ react: @tanstack/router-cli
815
+ solid: @tanstack/router-cli
816
+
817
+ <!-- ::end:tabs -->
818
+
819
+ Once installed, you'll need to amend your scripts in your \`package.json\` for the CLI to \`watch\` and \`generate\` files.
820
+
821
+ \`\`\`json
822
+ {
823
+ "scripts": {
824
+ "generate-routes": "tsr generate",
825
+ "watch-routes": "tsr watch",
826
+ "build": "npm run generate-routes && ...",
827
+ "dev": "npm run watch-routes && ..."
828
+ }
829
+ }
830
+ \`\`\`
831
+
832
+ <!-- ::start:framework -->
833
+
834
+ # Solid
835
+
836
+ If you are using TypeScript, you should also add the following options to your \`tsconfig.json\`:
837
+
838
+ \`\`\`json
839
+ {
840
+ "compilerOptions": {
841
+ "jsx": "preserve",
842
+ "jsxImportSource": "solid-js"
843
+ }
844
+ }
845
+ \`\`\`
846
+
847
+ With that, you're all set to start using file-based routing with TanStack Router.
848
+
849
+ <!-- ::end:framework -->
850
+
851
+ [//]: # 'AfterScripts'
852
+ [//]: # 'AfterScripts'
853
+
854
+ You shouldn't forget to _ignore_ the generated route tree file. Head over to the [Ignoring the generated route tree file](#ignoring-the-generated-route-tree-file) section to learn more.
855
+
856
+ With the CLI installed, the following commands are made available via the \`tsr\` command
857
+
858
+ ## Using the \`generate\` command
859
+
860
+ Generates the routes for a project based on the provided configuration.
861
+
862
+ \`\`\`sh
863
+ tsr generate
864
+ \`\`\`
865
+
866
+ ## Using the \`watch\` command
867
+
868
+ Continuously watches the specified directories and regenerates routes as needed.
869
+
870
+ **Usage:**
871
+
872
+ \`\`\`sh
873
+ tsr watch
874
+ \`\`\`
875
+
876
+ With file-based routing enabled, whenever you start your application in development mode, TanStack Router will watch your configured \`routesDirectory\` and generate your route tree whenever a file is added, removed, or changed.
877
+
878
+ ## Ignoring the generated route tree file
879
+
880
+ If your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.
881
+
882
+ Here are some resources to help you ignore the generated route tree file:
883
+
884
+ - Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)
885
+ - ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)
886
+ - Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)
887
+
888
+ > [!WARNING]
889
+ > If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.
890
+
891
+ You can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:
892
+
893
+ \`\`\`json
894
+ {
895
+ "files.readonlyInclude": {
896
+ "**/routeTree.gen.ts": true
897
+ },
898
+ "files.watcherExclude": {
899
+ "**/routeTree.gen.ts": true
900
+ },
901
+ "search.exclude": {
902
+ "**/routeTree.gen.ts": true
903
+ }
904
+ }
905
+ \`\`\`
906
+
907
+ You can use those settings either at a user level or only for a single workspace by creating the file \`.vscode/settings.json\` at the root of your project.
908
+
909
+ ## Configuration
910
+
911
+ When using the TanStack Router CLI for File-based routing, it comes with some sane defaults that should work for most projects:
912
+
913
+ <!-- ::start:framework -->
914
+
915
+ # React
916
+
917
+ \`\`\`json
918
+ {
919
+ "routesDirectory": "./src/routes",
920
+ "generatedRouteTree": "./src/routeTree.gen.ts",
921
+ "routeFileIgnorePrefix": "-",
922
+ "quoteStyle": "single",
923
+ "target": "react"
924
+ }
925
+ \`\`\`
926
+
927
+ # Solid
928
+
929
+ \`\`\`json
930
+ {
931
+ "routesDirectory": "./src/routes",
932
+ "generatedRouteTree": "./src/routeTree.gen.ts",
933
+ "routeFileIgnorePrefix": "-",
934
+ "quoteStyle": "single",
935
+ "target": "solid"
936
+ }
937
+ \`\`\`
938
+
939
+ <!-- ::end:framework -->
940
+
941
+ If these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by creating a \`tsr.config.json\` file in the root of your project directory.
942
+
943
+ You can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).
944
+
945
+ # Installation with Rspack
946
+
947
+ To use file-based routing with **Rspack** or **Rsbuild**, you'll need to install the \`@tanstack/router-plugin\` package.
948
+
949
+ <!-- ::start:tabs variant="package-manager" mode="dev-install" -->
950
+
951
+ react: @tanstack/router-plugin
952
+ solid: @tanstack/router-plugin
953
+
954
+ <!-- ::end:tabs -->
955
+
956
+ Once installed, you'll need to add the plugin to your configuration.
957
+
958
+ <!-- ::start:framework -->
959
+
960
+ # React
961
+
962
+ \`\`\`ts title="rsbuild.config.ts"
963
+ import { defineConfig } from '@rsbuild/core'
964
+ import { pluginReact } from '@rsbuild/plugin-react'
965
+ import { tanstackRouter } from '@tanstack/router-plugin/rspack'
966
+
967
+ export default defineConfig({
968
+ plugins: [pluginReact()],
969
+ tools: {
970
+ rspack: {
971
+ plugins: [
972
+ tanstackRouter({
973
+ target: 'react',
974
+ autoCodeSplitting: true,
975
+ }),
976
+ ],
977
+ },
978
+ },
979
+ })
980
+ \`\`\`
981
+
982
+ Or, you can clone our [Quickstart Rspack/Rsbuild example](https://github.com/TanStack/router/tree/main/examples/react/quickstart-rspack-file-based) and get started.
983
+
984
+ # Solid
985
+
986
+ \`\`\`ts title="rsbuild.config.ts"
987
+ import { defineConfig } from '@rsbuild/core'
988
+ import { pluginBabel } from '@rsbuild/plugin-babel'
989
+ import { pluginSolid } from '@rsbuild/plugin-solid'
990
+ import { tanstackRouter } from '@tanstack/router-plugin/rspack'
991
+
992
+ export default defineConfig({
993
+ plugins: [
994
+ pluginBabel({
995
+ include: /\.(?:jsx|tsx)$/,
996
+ }),
997
+ pluginSolid(),
998
+ ],
999
+ tools: {
1000
+ rspack: {
1001
+ plugins: [tanstackRouter({ target: 'solid', autoCodeSplitting: true })],
1002
+ },
1003
+ },
1004
+ })
1005
+ \`\`\`
1006
+
1007
+ Or, you can clone our [Quickstart Rspack/Rsbuild example](https://github.com/TanStack/router/tree/main/examples/solid/quickstart-rspack-file-based) and get started.
1008
+
1009
+ <!-- ::end:framework -->
1010
+
1011
+ Now that you've added the plugin to your Rspack/Rsbuild configuration, you're all set to start using file-based routing with TanStack Router.
1012
+
1013
+ ## Ignoring the generated route tree file
1014
+
1015
+ If your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.
1016
+
1017
+ Here are some resources to help you ignore the generated route tree file:
1018
+
1019
+ - Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)
1020
+ - ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)
1021
+ - Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)
1022
+
1023
+ > [!WARNING]
1024
+ > If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.
1025
+
1026
+ You can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:
1027
+
1028
+ \`\`\`json
1029
+ {
1030
+ "files.readonlyInclude": {
1031
+ "**/routeTree.gen.ts": true
1032
+ },
1033
+ "files.watcherExclude": {
1034
+ "**/routeTree.gen.ts": true
1035
+ },
1036
+ "search.exclude": {
1037
+ "**/routeTree.gen.ts": true
1038
+ }
1039
+ }
1040
+ \`\`\`
1041
+
1042
+ You can use those settings either at a user level or only for a single workspace by creating the file \`.vscode/settings.json\` at the root of your project.
1043
+
1044
+ ## Configuration
1045
+
1046
+ When using the TanStack Router Plugin with Rspack (or Rsbuild) for File-based routing, it comes with some sane defaults that should work for most projects:
1047
+
1048
+ \`\`\`json
1049
+ {
1050
+ "routesDirectory": "./src/routes",
1051
+ "generatedRouteTree": "./src/routeTree.gen.ts",
1052
+ "routeFileIgnorePrefix": "-",
1053
+ "quoteStyle": "single"
1054
+ }
1055
+ \`\`\`
1056
+
1057
+ If these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by editing the configuration object passed into the \`tanstackRouter\` function.
1058
+
1059
+ You can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).
1060
+
1061
+ # Installation with Vite
1062
+
1063
+ To use file-based routing with **Vite**, you'll need to install the \`@tanstack/router-plugin\` package.
1064
+
1065
+ <!-- ::start:tabs variant="package-manager" mode="dev-install" -->
1066
+
1067
+ react: @tanstack/router-plugin
1068
+ solid: @tanstack/router-plugin
1069
+
1070
+ <!-- ::end:tabs -->
1071
+
1072
+ Once installed, you'll need to add the plugin to your Vite configuration.
1073
+
1074
+ <!-- ::start:framework -->
1075
+
1076
+ # React
1077
+
1078
+ \`\`\`ts title="vite.config.ts"
1079
+ import { defineConfig } from 'vite'
1080
+ import react from '@vitejs/plugin-react'
1081
+ import { tanstackRouter } from '@tanstack/router-plugin/vite'
1082
+
1083
+ // https://vitejs.dev/config/
1084
+ export default defineConfig({
1085
+ plugins: [
1086
+ // Please make sure that '@tanstack/router-plugin' is passed before '@vitejs/plugin-react'
1087
+ tanstackRouter({
1088
+ target: 'react',
1089
+ autoCodeSplitting: true,
1090
+ }),
1091
+ react(),
1092
+ // ...
1093
+ ],
1094
+ })
1095
+ \`\`\`
1096
+
1097
+ Or, you can clone our [Quickstart Vite example](https://github.com/TanStack/router/tree/main/examples/react/quickstart-file-based) and get started.
1098
+
1099
+ # Solid
1100
+
1101
+ \`\`\`ts title="vite.config.ts"
1102
+ import { defineConfig } from 'vite'
1103
+ import solid from 'vite-plugin-solid'
1104
+ import { tanstackRouter } from '@tanstack/router-plugin/vite'
1105
+
1106
+ // https://vitejs.dev/config/
1107
+ export default defineConfig({
1108
+ plugins: [
1109
+ tanstackRouter({
1110
+ target: 'solid',
1111
+ autoCodeSplitting: true,
1112
+ }),
1113
+ solid(),
1114
+ // ...
1115
+ ],
1116
+ })
1117
+ \`\`\`
1118
+
1119
+ Or, you can clone our [Quickstart Vite example](https://github.com/TanStack/router/tree/main/examples/solid/quickstart-file-based) and get started.
1120
+
1121
+ <!-- ::end:framework -->
1122
+
1123
+ Now that you've added the plugin to your Vite configuration, you're all set to start using file-based routing with TanStack Router.
1124
+
1125
+ ## Ignoring the generated route tree file
1126
+
1127
+ If your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.
1128
+
1129
+ Here are some resources to help you ignore the generated route tree file:
1130
+
1131
+ - Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)
1132
+ - ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)
1133
+ - Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)
1134
+
1135
+ > [!WARNING]
1136
+ > If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.
1137
+
1138
+ You can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:
1139
+
1140
+ \`\`\`json
1141
+ {
1142
+ "files.readonlyInclude": {
1143
+ "**/routeTree.gen.ts": true
1144
+ },
1145
+ "files.watcherExclude": {
1146
+ "**/routeTree.gen.ts": true
1147
+ },
1148
+ "search.exclude": {
1149
+ "**/routeTree.gen.ts": true
1150
+ }
1151
+ }
1152
+ \`\`\`
1153
+
1154
+ You can use those settings either at a user level or only for a single workspace by creating the file \`.vscode/settings.json\` at the root of your project.
1155
+
1156
+ ## Configuration
1157
+
1158
+ When using the TanStack Router Plugin with Vite for File-based routing, it comes with some sane defaults that should work for most projects:
1159
+
1160
+ \`\`\`json
1161
+ {
1162
+ "routesDirectory": "./src/routes",
1163
+ "generatedRouteTree": "./src/routeTree.gen.ts",
1164
+ "routeFileIgnorePrefix": "-",
1165
+ "quoteStyle": "single"
1166
+ }
1167
+ \`\`\`
1168
+
1169
+ If these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by editing the configuration object passed into the \`tanstackRouter\` function.
1170
+
1171
+ You can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).
1172
+
1173
+ # Installation with Webpack
1174
+
1175
+ To use file-based routing with **Webpack**, you'll need to install the \`@tanstack/router-plugin\` package.
1176
+
1177
+ <!-- ::start:tabs variant="package-manager" mode="dev-install" -->
1178
+
1179
+ react: @tanstack/router-plugin
1180
+ solid: @tanstack/router-plugin
1181
+
1182
+ <!-- ::end:tabs -->
1183
+
1184
+ Once installed, you'll need to add the plugin to your configuration.
1185
+
1186
+ <!-- ::start:framework -->
1187
+
1188
+ # React
1189
+
1190
+ \`\`\`ts title="webpack.config.ts"
1191
+ import { tanstackRouter } from '@tanstack/router-plugin/webpack'
1192
+
1193
+ export default {
1194
+ plugins: [
1195
+ tanstackRouter({
1196
+ target: 'react',
1197
+ autoCodeSplitting: true,
1198
+ }),
1199
+ ],
1200
+ }
1201
+ \`\`\`
1202
+
1203
+ Or, you can clone our [Quickstart Webpack example](https://github.com/TanStack/router/tree/main/examples/react/quickstart-webpack-file-based) and get started.
1204
+
1205
+ # Solid
1206
+
1207
+ \`\`\`ts title="webpack.config.ts"
1208
+ import { tanstackRouter } from '@tanstack/router-plugin/webpack'
1209
+
1210
+ export default {
1211
+ plugins: [
1212
+ tanstackRouter({
1213
+ target: 'solid',
1214
+ autoCodeSplitting: true,
1215
+ }),
1216
+ ],
1217
+ }
1218
+ \`\`\`
1219
+
1220
+ And in the .babelrc (SWC doesn't support solid-js, see [here](https://www.answeroverflow.com/m/1135200483116593182)), add these presets:
1221
+
1222
+ \`\`\`tsx
1223
+ // .babelrc
1224
+
1225
+ {
1226
+ "presets": ["babel-preset-solid", "@babel/preset-typescript"]
1227
+ }
1228
+
1229
+ \`\`\`
1230
+
1231
+ Or, for a full webpack.config.js, you can clone our [Quickstart Webpack example](https://github.com/TanStack/router/tree/main/examples/solid/quickstart-webpack-file-based) and get started.
1232
+
1233
+ <!-- ::end:framework -->
1234
+
1235
+ Now that you've added the plugin to your Webpack configuration, you're all set to start using file-based routing with TanStack Router.
1236
+
1237
+ ## Ignoring the generated route tree file
1238
+
1239
+ If your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.
1240
+
1241
+ Here are some resources to help you ignore the generated route tree file:
1242
+
1243
+ - Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)
1244
+ - ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)
1245
+ - Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)
1246
+
1247
+ > [!WARNING]
1248
+ > If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.
1249
+
1250
+ You can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:
1251
+
1252
+ \`\`\`json
1253
+ {
1254
+ "files.readonlyInclude": {
1255
+ "**/routeTree.gen.ts": true
1256
+ },
1257
+ "files.watcherExclude": {
1258
+ "**/routeTree.gen.ts": true
1259
+ },
1260
+ "search.exclude": {
1261
+ "**/routeTree.gen.ts": true
1262
+ }
1263
+ }
1264
+ \`\`\`
1265
+
1266
+ You can use those settings either at a user level or only for a single workspace by creating the file \`.vscode/settings.json\` at the root of your project.
1267
+
1268
+ ## Configuration
1269
+
1270
+ When using the TanStack Router Plugin with Webpack for File-based routing, it comes with some sane defaults that should work for most projects:
1271
+
1272
+ \`\`\`json
1273
+ {
1274
+ "routesDirectory": "./src/routes",
1275
+ "generatedRouteTree": "./src/routeTree.gen.ts",
1276
+ "routeFileIgnorePrefix": "-",
1277
+ "quoteStyle": "single"
1278
+ }
1279
+ \`\`\`
1280
+
1281
+ If these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by editing the configuration object passed into the \`tanstackRouter\` function.
1282
+
1283
+ You can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).
1284
+
1285
+ `;