Skip to content

fix: fix jiti usage for tsconfig paths#7382

Merged
schiller-manuel merged 5 commits into
mainfrom
copilot/fix-jiti-usage
May 11, 2026
Merged

fix: fix jiti usage for tsconfig paths#7382
schiller-manuel merged 5 commits into
mainfrom
copilot/fix-jiti-usage

Conversation

@schiller-manuel
Copy link
Copy Markdown
Collaborator

@schiller-manuel schiller-manuel commented May 11, 2026

closes #7275

Summary by CodeRabbit

  • New Features

    • Virtual route config loading now honors TypeScript tsconfig path aliases, improving import resolution for route modules.
  • Tests

    • Added test fixtures and automated checks covering virtual route configurations with tsconfig path alias support.

Review Change Stack

Copilot AI and others added 4 commits May 11, 2026 14:49
Agent-Logs-Url: https://github.com/TanStack/router/sessions/0a481c9b-eb97-4543-acc5-71d43b97d386

Co-authored-by: schiller-manuel <6340397+schiller-manuel@users.noreply.github.com>
Agent-Logs-Url: https://github.com/TanStack/router/sessions/182b9baa-9e54-4813-a322-c33a1da5417d

Co-authored-by: schiller-manuel <6340397+schiller-manuel@users.noreply.github.com>
Agent-Logs-Url: https://github.com/TanStack/router/sessions/182b9baa-9e54-4813-a322-c33a1da5417d

Co-authored-by: schiller-manuel <6340397+schiller-manuel@users.noreply.github.com>
Agent-Logs-Url: https://github.com/TanStack/router/sessions/ab1a42cc-7326-4e36-a656-f01179221cee

Co-authored-by: schiller-manuel <6340397+schiller-manuel@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ce00b901-0b1d-4d6c-949a-b8f51bcde99a

📥 Commits

Reviewing files that changed from the base of the PR and between 0c618ce and b0dd8c5.

📒 Files selected for processing (1)
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes.ts

📝 Walkthrough

Walkthrough

Router generator now enables TypeScript tsconfig path alias resolution when loading virtual route configuration files. The core change adds tsconfigPaths: true to Jiti options. A test suite validates the feature with an aliased subtree and nested route hierarchy using a @/* alias.

Changes

TypeScript tsconfig Path Resolution

Layer / File(s) Summary
Jiti Configuration
packages/router-generator/src/filesystem/virtual/loadConfigFile.ts
loadConfigFile instantiates Jiti with tsconfigPaths: true and interopDefault: false to resolve TypeScript path aliases.
Test Configuration
packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/tsconfig.json, packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/tsr.config.json
Fixture tsconfig defines @/*./aliased/*; tsr.config.json points the generator at the test routes directory, generated output, and virtual config module.
Aliased Virtual Routes
packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/aliased/virtual-routes.ts
New module exported via the @/* alias providing helloSubtree as a physical route.
Route File Hierarchy
packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/*, .../db/*, .../subtree/*
Multiple file-route definitions added: root, index, layout, pages (/$lang/), dashboard, invoices, invoice detail, and nested subtree routes used by the test.
Route Tree Orchestration
packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes.ts
Composes file routes and the aliased helloSubtree into the exported route tree with proper nesting.
Generated Route Tree
packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routeTree.snapshot.ts
Snapshot of expected generator output: route constants with id/path/getParentRoute, typed route mapping interfaces, and module augmentation for TanStack React Router.
Release Notes
.changeset/quiet-rivers-serve.md
Changeset documents a patch release for @tanstack/router-generator enabling tsconfig path alias resolution.

🎯 2 (Simple) | ⏱️ ~12 minutes

🐰 With aliases now resolved, our config files dance free,

Path mappings spring to life in harmony,
No more module-not-found to make us weep,
The router's routes run nested and deep! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: fix jiti usage for tsconfig paths' clearly and specifically summarizes the main change - fixing jiti configuration to properly handle TypeScript path aliases in tsconfig.
Linked Issues check ✅ Passed The PR addresses issue #7275 by enabling TypeScript path alias resolution in the Jiti loader. Changes to loadConfigFile.ts add 'tsconfigPaths: true' configuration, directly fixing the reported 'Cannot find module' error when importing with path aliases.
Out of Scope Changes check ✅ Passed All changes are in-scope: the core fix modifies loadConfigFile.ts to support tsconfig paths, and new test files comprehensively validate the fix with path aliases configured in tsconfig.json.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch copilot/fix-jiti-usage

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 11, 2026

View your CI Pipeline Execution ↗ for commit 0c618ce

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ❌ Failed 3m 17s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-11 19:03:17 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

🚀 Changeset Version Preview

6 package(s) bumped directly, 18 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/start-client-core 1.168.2 → 1.169.0 Changeset

🟩 Patch bumps

Package Version Reason
@tanstack/router-core 1.169.2 → 1.169.3 Changeset
@tanstack/router-generator 1.166.42 → 1.166.43 Changeset
@tanstack/start-fn-stubs 1.161.6 → 1.161.7 Changeset
@tanstack/start-plugin-core 1.169.20 → 1.169.21 Changeset
@tanstack/start-server-core 1.167.30 → 1.167.31 Changeset
@tanstack/react-router 1.169.2 → 1.169.3 Dependent
@tanstack/react-start 1.167.65 → 1.167.66 Dependent
@tanstack/react-start-client 1.166.48 → 1.166.49 Dependent
@tanstack/react-start-rsc 0.0.44 → 0.0.45 Dependent
@tanstack/react-start-server 1.166.52 → 1.166.53 Dependent
@tanstack/router-cli 1.166.43 → 1.166.44 Dependent
@tanstack/router-plugin 1.167.35 → 1.167.36 Dependent
@tanstack/router-vite-plugin 1.166.50 → 1.166.51 Dependent
@tanstack/solid-router 1.169.2 → 1.169.3 Dependent
@tanstack/solid-start 1.167.62 → 1.167.63 Dependent
@tanstack/solid-start-client 1.166.47 → 1.166.48 Dependent
@tanstack/solid-start-server 1.166.51 → 1.166.52 Dependent
@tanstack/start-static-server-functions 1.166.41 → 1.166.42 Dependent
@tanstack/start-storage-context 1.166.35 → 1.166.36 Dependent
@tanstack/vue-router 1.169.2 → 1.169.3 Dependent
@tanstack/vue-start 1.167.58 → 1.167.59 Dependent
@tanstack/vue-start-client 1.166.43 → 1.166.44 Dependent
@tanstack/vue-start-server 1.166.47 → 1.166.48 Dependent

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 11, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7382

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7382

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7382

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7382

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7382

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7382

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7382

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7382

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7382

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7382

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7382

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7382

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7382

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7382

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7382

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7382

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7382

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7382

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7382

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7382

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7382

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7382

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7382

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7382

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7382

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7382

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7382

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7382

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7382

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7382

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7382

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7382

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7382

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7382

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7382

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7382

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7382

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7382

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7382

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7382

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7382

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7382

commit: b0dd8c5

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

Bundle Size Benchmarks

  • Commit: b1c061aff918
  • Measured at: 2026-05-11T19:01:05.994Z
  • Baseline source: history:b1c061aff918
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 87.29 KiB 0 B (0.00%) 87.15 KiB 274.07 KiB 75.85 KiB ▁▁▁▁▁▁▁▁▁██
react-router.full 90.82 KiB 0 B (0.00%) 90.68 KiB 285.58 KiB 78.89 KiB ▁▁▁▁▁▁▁▁▁██
solid-router.minimal 35.51 KiB 0 B (0.00%) 35.39 KiB 106.36 KiB 31.97 KiB ▁▁▁▁▁▁▁▁▁██
solid-router.full 40.23 KiB 0 B (0.00%) 40.10 KiB 120.58 KiB 36.14 KiB ▁▁▁▁▁▁▁▁▁██
vue-router.minimal 53.29 KiB 0 B (0.00%) 53.15 KiB 151.51 KiB 47.85 KiB ▁▁▁▁▁▁▁▁▁██
vue-router.full 58.41 KiB 0 B (0.00%) 58.28 KiB 167.69 KiB 52.39 KiB ▁▁▁▁▁▁▁▁▁██
react-start.minimal 101.97 KiB 0 B (0.00%) 101.83 KiB 322.51 KiB 88.17 KiB ▁▁▁▁▁▁▁▁▃██
react-start.full 105.41 KiB 0 B (0.00%) 105.27 KiB 332.84 KiB 91.19 KiB ▁▁▁▁▁▁▁▁▄██
react-start.rsbuild.minimal 99.60 KiB 0 B (0.00%) 99.43 KiB 316.97 KiB 85.64 KiB ▁▁▁▁▁▁▁▁▄██
react-start.rsbuild.full 102.89 KiB 0 B (0.00%) 102.72 KiB 327.41 KiB 88.45 KiB ▁▁▁▁▁▁▁▁▃██
solid-start.minimal 49.61 KiB 0 B (0.00%) 49.48 KiB 152.48 KiB 43.78 KiB ▁▁▁▁▁▁▁▁▄██
solid-start.full 55.40 KiB 0 B (0.00%) 55.27 KiB 169.39 KiB 48.72 KiB ▁▁▁▁▁▁▁▁▄██

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes.ts`:
- Line 1: Remove the top-line "// `@ts-nocheck`" from the TypeScript fixture so
the file is fully type-checked; then fix any resulting type errors in this file
(check imports from "@tanstack/virtual-file-routes" and usages of tsconfig path
aliases) by adding proper type annotations or correcting import paths/usages so
the file compiles under the repo's strict TypeScript settings and passes the
repo typecheck.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3d691dfe-5521-46c8-8a9a-b16bea9368a6

📥 Commits

Reviewing files that changed from the base of the PR and between b1c061a and 0c618ce.

📒 Files selected for processing (19)
  • .changeset/quiet-rivers-serve.md
  • packages/router-generator/src/filesystem/virtual/loadConfigFile.ts
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/aliased/virtual-routes.ts
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes.ts
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/db/dashboard-index.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/db/dashboard-invoices.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/db/dashboard.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/db/invoice-detail.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/db/invoices-index.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/index.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/layout.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/pages.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/root.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/subtree/foo/$id.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/subtree/foo/index.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routes/subtree/index.tsx
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/tsconfig.json
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/tsr.config.json

Agent-Logs-Url: https://github.com/TanStack/router/sessions/22194166-b3a7-431e-b723-ad594d4b0405

Co-authored-by: schiller-manuel <6340397+schiller-manuel@users.noreply.github.com>
nx-cloud[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nx Cloud has identified a flaky task in your failed CI:

🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.

Nx Cloud View detailed reasoning in Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 11, 2026

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing copilot/fix-jiti-usage (b0dd8c5) with main (b1c061a)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@schiller-manuel schiller-manuel merged commit 038cd12 into main May 11, 2026
15 of 16 checks passed
@schiller-manuel schiller-manuel deleted the copilot/fix-jiti-usage branch May 11, 2026 19:16
@github-actions github-actions Bot mentioned this pull request May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@tanstack/router-cli@1.166.35 generate fails with newest 1.66.36 version

2 participants