TanStack / TanStack/router

support serving via a Relative base url

Open
#5,966 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Which project does this relate to?

Start

Describe the bug

I have an app that is running in an iFrame within another app (home assistant).

Because of this I need to use relative URLs for my assets otherwise things will not resolve because they hit the server of the host app.

I've tried setting base: "./", in my vite config, and also I have SPA enabled to keep things as simple as possible. When I check my _start.html my links look like the following:

href="/./assets/main-aAavoY_p.js"

so I don't get a relative url and the page breaks.

Your Example Website or App

na

Steps to Reproduce the Bug or Issue
  1. create a default app
  2. serve within an iframe of a host app
  3. 😭
Expected behavior

I would love to be able to use this router to build my addon (and in fact already have ;)) however I'm not able to deploy or ship it because I'm having a hard time getting it to run in the only environment its possible for it to run in.

Screenshots or Videos

No response

Platform
  • Router / Start Version: [e.g. 1.121.0]
  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Browser Version: [e.g. 91.1]
  • Bundler: [e.g. vite]
  • Bundler Version: [e.g. 7.0.0]
Additional context

No response

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 a default app using the Vite config setting base: "./", then inspect the generated _start.html and its asset links. Reproduce the app inside an iframe and verify that the generated links are truly relative rather than beginning with /./; done means the app can load its assets from the host app's relative path.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
build-system, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.