T
TanStack8mo ago
old-apricot

How do I get `<base href='...' />` to the top of the head document returned by createRootRoute?

<head> <base href='...' /> <Meta /> </head> It seems like <Meta /> automatically inserts things to <head /> and <base /> ends up getting injected after the <script /> that has a relative route for the build.
7 Replies
other-emerald
other-emerald8mo ago
are you using start?
old-apricot
old-apricotOP8mo ago
Yes
other-emerald
other-emerald8mo ago
right now the only way is to use router.injectHtml outside of react because in react 19 (which I guess you are using ?) react places the script itself and we can't manipulate that
old-apricot
old-apricotOP8mo ago
Haven't upgraded to react 19 yet.
other-emerald
other-emerald8mo ago
btw we have #start-questions for those kind of questions in react 18 the script should not be moved up
old-apricot
old-apricotOP8mo ago
I'm sorry I was mistaken react 19 is where I'm seeing this behavior so router.injectHTMl in client.tsx?
other-emerald
other-emerald8mo ago
no on the server router.serverSsr.injectHtml but that's not a stable API, we will rework it i guess but you try it out if it works wait this won't work you would get a hydration error

Did you find this page helpful?