Capítulo 9 de 57
File-based routing under Rspack or Rsbuild uses the same @tanstack/router-plugin package, added through tools.rspack.plugins in rsbuild.config.ts (React uses pluginReact; Solid needs pluginBabel targeting .jsx/.tsx alongside pluginSolid), with identical defaults and ignore-file guidance as the Vite integration.
@tanstack/router-plugin/rspack: The Rspack-specific entry point for the tanstackRouter plugin function.tools.rspack.plugins, separate from the top-level plugins array used for pluginReact/pluginSolid.pluginBabel({ include: /\.(?:jsx|tsx)$/ }) combined with pluginSolid(), since SWC (Rspack's default) doesn't support Solid's compiler transform.routesDirectory: "./src/routes", generatedRouteTree: "./src/routeTree.gen.ts", routeFileIgnorePrefix: "-", quoteStyle: "single".routeTree.gen.ts should be excluded from Prettier/ESLint/Biome and marked readonly/excluded in VSCode, exactly as with the Vite setup.// rsbuild.config.ts
import { defineConfig } from '@rsbuild/core'
import { pluginReact } from '@rsbuild/plugin-react'
import { tanstackRouter } from '@tanstack/router-plugin/rspack'
export default defineConfig({
plugins: [pluginReact()],
tools: {
rspack: {
plugins: [
tanstackRouter({
target: 'react',
autoCodeSplitting: true,
}),
],
},
},
})
tools.rspack.plugins, distinct from the framework plugin location.tools.rspack.plugins vs top-level plugins) differs.routeTree.gen.ts as documented for Vite.@tanstack/router-plugin package and defaults.