René's URL Explorer Experiment


Title: [Bug] --router-only main.tsx ignores getRouter() from router.tsx (router.tsx becomes dead code + duplicate Register declaration) · Issue #480 · TanStack/cli · GitHub

Open Graph Title: [Bug] --router-only main.tsx ignores getRouter() from router.tsx (router.tsx becomes dead code + duplicate Register declaration) · Issue #480 · TanStack/cli

X Title: [Bug] --router-only main.tsx ignores getRouter() from router.tsx (router.tsx becomes dead code + duplicate Register declaration) · Issue #480 · TanStack/cli

Description: Which project does this relate to? Create Tanstack App Describe the bug When scaffolding a Router-only SPA (create --router-only), the generated src/router.tsx exports a getRouter() factory, but the generated src/main.tsx does not use it...

Open Graph Description: Which project does this relate to? Create Tanstack App Describe the bug When scaffolding a Router-only SPA (create --router-only), the generated src/router.tsx exports a getRouter() factory, but th...

X Description: Which project does this relate to? Create Tanstack App Describe the bug When scaffolding a Router-only SPA (create --router-only), the generated src/router.tsx exports a getRouter() factory, but th...

Opengraph URL: https://github.com/TanStack/cli/issues/480

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug] --router-only main.tsx ignores getRouter() from router.tsx (router.tsx becomes dead code + duplicate Register declaration)","articleBody":"### Which project does this relate to?\n\nCreate Tanstack App\n\n### Describe the bug\n\nWhen scaffolding a Router-only SPA (`create --router-only`), the generated `src/router.tsx` exports a `getRouter()` factory, but the generated `src/main.tsx` does **not** use it. Instead, `main.tsx` builds its own router inline with `createRouter(...)`.\n\nAs a result:\n\n1. `router.tsx` / `getRouter()` is **dead code** - nothing imports it anywhere in a `--router-only` project.\n2. The `declare module '@tanstack/react-router' { interface Register { ... } }` block is **duplicated** in both `main.tsx` (`router: typeof router`) and `router.tsx` (`router: ReturnType\u003ctypeof getRouter>`).\n\nIn the default (TanStack Start) mode this is fine because Start consumes `getRouter()` from `router.tsx` as the entry, and `main.tsx` is not generated. But in `--router-only` mode the two files diverge and `router.tsx` is left orphaned.\n\n### Your Example Website or App\n\npnpx @tanstack/cli create --router-only\n\n### Steps to Reproduce the Bug or Issue\n\n1. `pnpx @tanstack/cli create --router-only`\n2. Open `src/main.tsx` and `src/router.tsx`\n3. Grep the project for `getRouter` -> only defined in `router.tsx`, never imported\n(No StackBlitz needed - this is reproducible purely from the CLI output.)\n\n### Expected behavior\n\nIn `--router-only` mode, `main.tsx` should import and use `getRouter()` from `router.tsx`, and the `Register` module augmentation should live in a single place (`router.tsx`). Something like:\n\n```tsx\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider } from '@tanstack/react-router'\nimport { getRouter } from './router'\n\nconst router = getRouter()\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\u003cRouterProvider router={router} />)\n}\n```\n\nThis keeps a single source of truth for router configuration across both Start and Router-only modes, removes the dead `getRouter()`, and removes the duplicate `Register` declaration.\n\n### Screenshots or Videos\n\n_No response_\n\n### Platform\n\n- OS: macOS\n- @tanstack/cli: 0.69.5\n\n### Additional context\n\n- `packages/create/src/frameworks/react/project/base/src/main.tsx.ejs`\n- Line 1: `\u003c% if (!routerOnly) { ignoreFile() } %>` -> only emitted for router-only\n- Lines 6-16: creates its own `router` + declares `Register` instead of importing `getRouter`\n- `packages/create/src/frameworks/react/project/base/src/router.tsx.ejs`\n- No `ignoreFile()` guard -> always emitted, exports `getRouter()` + declares `Register`\n\nThe Solid templates have an identical structure:\n- `packages/create/src/frameworks/solid/project/base/src/main.tsx.ejs`\n- `packages/create/src/frameworks/solid/project/base/src/router.tsx.ejs`","author":{"url":"https://github.com/gs0428","@type":"Person","name":"gs0428"},"datePublished":"2026-06-25T12:54:42Z","url":"https://github.com/TanStack/cli/issues/480"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ee8cbd5c-ef06-df13-444d-d5f7adec1abc
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA0B2:1A28DE:1940AA:238381:6AF9A250
html-safe-noncea5be1914ac65db3e2b7fb8d39b0c7c23768936060428a0541b9e8cc3a95454db
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMEIyOjFBMjhERToxOTQwQUE6MjM4MzgxOjZBRjlBMjUwIiwidmlzaXRvcl9pZCI6IjI0MDgxNTc3MDA0NTg5MTQzODQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf023f685a8a061881f71a7e65020830519176e1cff3c8d2ba7229712a5bb37a5
hovercard-subject-tagissue:4743980283
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/TanStack/cli/480/issue_layout
twitter:imagehttps://opengraph.githubassets.com/79a8ffc279b3b148d2fd2dd890d55b118dc40e981d7502a2e0c0ee264eebb4ab/TanStack/cli/issues/480
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/79a8ffc279b3b148d2fd2dd890d55b118dc40e981d7502a2e0c0ee264eebb4ab/TanStack/cli/issues/480
og:image:altWhich project does this relate to? Create Tanstack App Describe the bug When scaffolding a Router-only SPA (create --router-only), the generated src/router.tsx exports a getRouter() factory, but th...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegs0428
hostnamegithub.com
expected-hostnamegithub.com
None612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7
turbo-cache-controlno-preview
go-importgithub.com/TanStack/cli git https://github.com/TanStack/cli.git
octolytics-dimension-user_id72518640
octolytics-dimension-user_loginTanStack
octolytics-dimension-repository_id932949058
octolytics-dimension-repository_nwoTanStack/cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id932949058
octolytics-dimension-repository_network_root_nwoTanStack/cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release072e34035c13c31543fba9f025cbbbda4210dae4
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/TanStack/cli/issues/480#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTanStack%2Fcli%2Fissues%2F480
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTanStack%2Fcli%2Fissues%2F480
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=TanStack%2Fcli
Reloadhttps://github.com/TanStack/cli/issues/480
Reloadhttps://github.com/TanStack/cli/issues/480
Reloadhttps://github.com/TanStack/cli/issues/480
TanStackhttps://github.com/TanStack
clihttps://github.com/TanStack/cli
Codehttps://github.com/TanStack/cli
Issues13 (13)https://github.com/TanStack/cli/issues
Pull requests23 (23)https://github.com/TanStack/cli/pulls
Discussionshttps://github.com/TanStack/cli/discussions
Actionshttps://github.com/TanStack/cli/actions
Projectshttps://github.com/TanStack/cli/projects
Security and qualityhttps://github.com/TanStack/cli/security
Insightshttps://github.com/TanStack/cli/pulse
https://github.com/TanStack/cli
New issuehttps://github.com/login?return_to=https://github.com/TanStack/cli/issues/480
New issuehttps://github.com/login?return_to=https://github.com/TanStack/cli/issues/480
#481https://github.com/TanStack/cli/pull/481
[Bug] --router-only main.tsx ignores getRouter() from router.tsx (router.tsx becomes dead code + duplicate Register declaration)https://github.com/TanStack/cli/issues/480#top
#481https://github.com/TanStack/cli/pull/481
https://github.com/gs0428
gs0428https://github.com/gs0428
on Jun 25, 2026https://github.com/TanStack/cli/issues/480#issue-4743980283
https://github.com/shonebinu
shonebinuhttps://github.com/shonebinu
on Jul 22, 2026https://github.com/TanStack/cli/issues/480#issuecomment-5048272253
tannerlinsleyhttps://github.com/tannerlinsley
completedhttps://github.com/TanStack/cli/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#481https://github.com/TanStack/cli/pull/481
on Nov 2, 2026https://github.com/TanStack/cli/issues/480#event-34872360276
Sign up for freehttps://github.com/signup?return_to=https://github.com/TanStack/cli/issues/480
Sign in to commenthttps://github.com/login?return_to=https://github.com/TanStack/cli/issues/480
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.