Skip to main content

Assess, plan, evolve.

Reusable compiler-aware skills that help coding agents understand, plan, and safely evolve your codebase.

2 packages

Sort by
M
tanStackRouter-CodeSplitting

This codemod automates the process of splitting your TanStack Router route files into two separate files to enable code splitting. By utilizing this codemod, you can easily move non-critical route configuration, such as the component, into a separate `.lazy.tsx` file, which allows for better performance and reduced initial load time in your React application. ## Before Code Splitting In the original setup, all route configurations, including critical and non-critical parts, are contained within a single file. ```tsx // src/routes/posts.tsx import { createFileRoute } from '@tanstack/react-router'; import { fetchPosts } from './api'; export const Route = createFileRoute('/posts')({ loader: fetchPosts, component: Posts, }); function Posts() { // ... } ``` ## After Code Splitting After running the codemod, the route configuration is split into two files: ### Critical Route Configuration The critical part of the route configuration remains in the original file: ```tsx // src/routes/posts.tsx import { createFileRoute } from '@tanstack/react-router'; import { fetchPosts } from './api'; export const Route = createFileRoute('/posts')({ loader: fetchPosts, }); ``` ### Non-Critical Route Configuration The non-critical part, such as the component, is moved to a new `.lazy.tsx` file: ```tsx // src/routes/posts.lazy.tsx import { createLazyFileRoute } from '@tanstack/react-router'; export const Route = createLazyFileRoute('/posts')({ component: Posts, }); function Posts() { // ... } ```

tanStackRouterCodeSplitting
v1.0.4
manishjha-04
0
a year ago
RRayamand avatar
nextjs-to-tanstack

Migrate a project from the Next.js App Router to TanStack Start

nextjstanstack+4
v1.3.12
Rayamand
16
3 months ago

Build your own codemod!

Describe the migration you need and Wish will create a codemod for you.

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.