TanStack / TanStack/router

TSRX Support

Open
#7,836 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Been trying out TSRX with a fresh TanStack Start app. Repo with the details and a stress-test page per TSRX feature: https://github.com/jamiedavenport/example-tsrx-tanstack

Found two things on the TanStack side worth flagging.

Dev SSR drops CSS from virtual modules

@tanstack/start-plugin-core's dev stylesheet collector (dev-styles.js) checks isCssFile(dep.file ?? dep.url). Vite always strips the query string off a resolved id to get ModuleNode.file, so a virtual module like <path>.tsrx?tsrx-css&lang.css ends up with .file = ...tsrx — not .css. The check fails and never falls through to .url, which does end in ...lang.css.

So scoped styles from .tsrx components just don't show up in the initial SSR HTML in dev (shows up after hydration instead). Production build is fine — Rollup's CSS chunking doesn't go through this.

Probably affects anything else using this "extension only lives in the query string" pattern too, e.g. Vue SFC <style> blocks.

Route file extensions are hardcoded

@tanstack/router-generator's directory walker hardcodes:

else if (fullPath.match(/\.(tsx|ts|jsx|js|vue)$/)) {

.tsrx doesn't match, so it only works as a component a .tsx route imports, not as a route file itself. .vue already gets special-cased here, so there's precedent, just not generalized.


Happy to send a PR for either, but wanted to check first since TSRX is still early — didn't want to assume it's worth building support for yet.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked TSRX TanStack Start stress-test app, then inspect the dev stylesheet collector in @tanstack/start-plugin-core's dev-styles.js and the directory walker in @tanstack/router-generator. Confirm both virtual-module CSS collection and .tsrx route discovery, and consider whether support for both behaviors is in scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.