Skip to content

when using baseurl link tag in head are not pre-peneded with baseurl #4134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
FatahChan opened this issue May 10, 2025 · 1 comment
Open

Comments

@FatahChan
Copy link
Contributor

FatahChan commented May 10, 2025

Which project does this relate to?

Start

Describe the bug

resource are not loading correctly, when using pre-rendered html, including css, link tags

// app/router.tsx
export function createRouter() {
  const router = createTanStackRouter({
    routeTree,
    scrollRestoration: true,
    basepath: "/shadcn-tanstack-form",
  });

  return router;
}
// app.confitg.ts
{
...
  server: {
    baseURL: "/shadcn-tanstack-form",
    prerender: {
      routes: ["/"],
      crawlLinks: true,
    }
  },

some resource are still loading from the "/" instead of "/shadcn-tanstack-form"

Your Example Website or App

https://github.com/FatahChan/shadcn-tanstack-form/tree/start-asset-pre-render-issue

Steps to Reproduce the Bug or Issue

  1. clone this branch https://github.com/FatahChan/shadcn-tanstack-form/tree/start-asset-pre-render-issue
  2. run pnpm build
  3. run npx serve .output/public
  4. open localhost:3000/shadcn-tanstack-form
  5. open network tab in devtools
  6. refresh the page

some resources will try to load from localhost:3000/ instead of `localhost:3000/shadcn-tanstack-form/

Expected behavior

all resources should load from shadcn-tanstack-form

Screenshots or Videos

Image

Platform

node 22

Additional context

I am trying to serve pre-rendered pages on github pages, that requires the repo name to be appened to the url

@SeanCassiere
Copy link
Member

When fixing this issue, we should add a new end-to-end sandbox, that uses a non / base path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants