foolish-indigoF
Refine4y ago
5 replies
foolish-indigo

I can't serve the app from a sub-directory

I want the base path of my app be /admin/. So for example the users list page would be /admin/users. I followed your instructions : Serving the application from a subdirectory (https://refine.dev/docs/api-reference/core/providers/router-provider/#serving-the-application-from-a-subdirectory)
I have a CustomRouterComponent component:
const { RouterComponent, location } = routerProvider;

const CustomRouterComponent = () => (
  <RouterComponent location={location} basepath="/admin" />
);

And I give it to<Refine>:
routerProvider={{
  ...routerProvider,
  RouterComponent: CustomRouterComponent,
}}

Now when I open /admin it automatically redirects to /admin/users which is a good sign but nothing renders on that page and any other page in my app. Am I missing something? I don't get any wired error in the console. I don't get a 404. Just nothing renders. All pages are empty.
I'm using Vite+React+TS+React location. All of my dependencies all up-to-date. I've also tried to set base to /admin/ in vite.config.ts but it didn't help:
export default defineConfig({
  plugins: [react(), tsconfigPaths()],
  base: "/admin/",
});
from
Was this page helpful?