router-plugin
БесплатноБез исполняемых скриптовНе проверенTanStack Router bundler plugin for route generation and automatic code splitting. Supports Vite, Webpack, Rspack, and esbuild. Configures autoCodeSplitting…
от TanStack★ 15 408 звёзд на GitHubОб этом скилле
Router Plugin (@tanstack/router-plugin)
Bundler plugin that powers TanStack Router's file-based routing and automatic code splitting. Works with Vite, Webpack, Rspack, and esbuild via unplugin.
CRITICAL: The router plugin MUST come before the framework plugin (React, Solid, Vue) in the Vite config. Wrong order causes route generation and code splitting to fail silently.
Install
npm install -D @tanstack/router-plugin
Bundler Setup
Vite (most common)
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { tanstackRouter } from '@tanstack/router-plugin/vite'
export default defineConfig({
plugins: [
// MUST come before react()
tanstackRouter({
target: 'react',
autoCodeSplitting: true,
}),
react(),
],
})
Webpack
// webpack.config.js
const { tanstackRouter } = require('@tanstack/router-plugin/webpack')
module.exports = {
plugins: [
tanstackRouter({
target: 'react',
autoCodeSplitting: true,
}),
],
}
Rspack
// rspack.config.js
const { tanstackRouter } = require('@tanstack/router-plugin/rspack')
module.exports = {
plugins: [
tanstackRouter({
target: 'react',
autoCodeSplitting: true,
}),
],
}
esbuild
import { tanstackRouter } from '@tanstack/router-plugin/esbuild'
import esbuild from 'esbuild'
esbuild.build({
plugins: [
tanstackRouter({
target: 'react',
}),
],
})
Automatic code splitting is not available with esbuild: the plugin throws when
autoCodeSplittingistrue. Use manual code splitting (.lazy.tsxfiles) or another bundler to split routes.
Configuration Options
Core Options
| Option | Type | Default | Description |
|---|---|---|---|
target |
'react' | 'solid' | 'vue' |
'react' |
Target framework |
routesDirectory |
string |
'./src/routes' |
Directory containing route files |
generatedRouteTree |
string |
'./src/routeTree.gen.ts' |
Path for generated route tree |
autoCodeSplitting |
boolean |
undefined |
Enable automatic code splitting |
File Convention Options
| Option | Type | Default | Description |
|---|---|---|---|
routeFilePrefix |
string |
undefined |
Prefix filter for route files |
routeFileIgnorePrefix |
string |
'-' |
Prefix to exclude files from routing |
routeFileIgnorePattern |
string |
undefined |
Pattern to exclude from routing |
indexToken |
string | RegExp | { regex: string; flags?: string } |
'index' |
Token identifying index routes |
routeToken |
string | RegExp | { regex: string; flags?: string } |
'route' |
Token identifying route config files |
Code Splitting Options
tanstackRouter({
target: 'react',
autoCodeSplitting: true,
codeSplittingOptions: {
// Default groupings for all routes
defaultBehavior: [['component'], ['errorComponent'], ['notFoundComponent']],
// Per-route custom splitting
splitBehavior: ({ routeId }) => {
if (routeId === '/dashboard') {
// Keep loader and component together for dashboard
return [['loader', 'component'], ['errorComponent']]
}
// Return undefined to use defaultBehavior
},
},
})
Output Options
| Option | Type | Default | Description |
|---|---|---|---|
quoteStyle |
'single' | 'double' |
'single' |
Quote style in generated code |
semicolons |
boolean |
false |
Use semicolons in generated code |
disableTypes |
boolean |
false |
Disable TypeScript types |
disableLogging |
boolean |
false |
Suppress plugin logs |
addExtensions |
boolean | string |
false |
Add file extensions to imports |
enableRouteTreeFormatting |
boolean |
true |
Format generated route tree |
Virtual Route Config
import { routes } from './routes'
tanstackRouter({
ta
Установить router-plugin в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл router-plugin?
TanStack Router bundler plugin for route generation and automatic code splitting. Supports Vite, Webpack, Rspack, and esbuild. Configures autoCodeSplitting, routesDirectory, target framework, and code split groupings.
Как установить скилл router-plugin?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл router-plugin запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic