diff --git a/e2e/start/basic/app/components/CustomMessage.tsx b/e2e/start/basic/app/components/CustomMessage.tsx
new file mode 100644
index 0000000000..d00e4eac60
--- /dev/null
+++ b/e2e/start/basic/app/components/CustomMessage.tsx
@@ -0,0 +1,10 @@
+import * as React from 'react'
+
+export function CustomMessage({ message }: { message: string }) {
+ return (
+
+
This is a custom message:
+
{message}
+
+ )
+}
diff --git a/e2e/start/basic/app/routes/index.tsx b/e2e/start/basic/app/routes/index.tsx
index 09a907cb18..37169a78b4 100644
--- a/e2e/start/basic/app/routes/index.tsx
+++ b/e2e/start/basic/app/routes/index.tsx
@@ -1,4 +1,5 @@
import { createFileRoute } from '@tanstack/react-router'
+import { CustomMessage } from '~/components/CustomMessage'
export const Route = createFileRoute('/')({
component: Home,
@@ -8,6 +9,7 @@ function Home() {
return (
Welcome Home!!!
+
)
}
diff --git a/packages/start-router-manifest/src/index.ts b/packages/start-router-manifest/src/index.ts
index b907916c36..9c03f9ca34 100644
--- a/packages/start-router-manifest/src/index.ts
+++ b/packages/start-router-manifest/src/index.ts
@@ -3,6 +3,10 @@ import tsrGetManifest from 'tsr:routes-manifest'
import { getManifest } from 'vinxi/manifest'
import type { Manifest } from '@tanstack/react-router'
+function sanitizeBase(base: string) {
+ return base.replace(/^\/|\/$/g, '')
+}
+
/**
* @description Returns the full, unfiltered router manifest. This includes relationships
* between routes, assets, and preloads and is NOT what you want to serialize and
@@ -18,9 +22,22 @@ export function getFullRouterManifest() {
// Always fake that HMR is ready
if (process.env.NODE_ENV === 'development') {
+ const CLIENT_BASE = sanitizeBase(process.env.TSS_CLIENT_BASE || '')
+
+ if (!CLIENT_BASE) {
+ throw new Error(
+ 'tanstack/start-router-manifest: TSS_CLIENT_BASE must be defined in your environment for getFullRouterManifest()',
+ )
+ }
+
rootRoute.assets.push({
tag: 'script',
- children: `window.__vite_plugin_react_preamble_installed__ = true`,
+ attrs: { type: 'module' },
+ children: `import RefreshRuntime from "/${CLIENT_BASE}/@react-refresh";
+RefreshRuntime.injectIntoGlobalHook(window)
+window.$RefreshReg$ = () => {}
+window.$RefreshSig$ = () => (type) => type
+window.__vite_plugin_react_preamble_installed__ = true`,
})
}