national-gold
national-gold2y ago

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" />
);
const { RouterComponent, location } = routerProvider;

const CustomRouterComponent = () => (
<RouterComponent location={location} basepath="/admin" />
);
And I give it to<Refine>:
routerProvider={{
...routerProvider,
RouterComponent: CustomRouterComponent,
}}
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/",
});
export default defineConfig({
plugins: [react(), tsconfigPaths()],
base: "/admin/",
});
from
5 Replies
flat-fuchsia
flat-fuchsia2y ago
Hey @amirhhashemi, I'm on this. I'm trying to reproduce the issue on my local machine. I'll let you know as soon as possible.
national-gold
national-gold2y ago
Thanks. let me know if you need more information
flat-fuchsia
flat-fuchsia2y ago
I reproduced the issue. You are right. It is a bug, it should work like the reference docs say. Could you open an issue? We will fix it as soon as possible. 🙏🏻 Thanks for reporting.
national-gold
national-gold2y ago
Sure. I'm gonna create an issue right now. Thanks for the confirmation
national-gold
national-gold2y ago
GitHub
[BUG] Can't serve the app from a subdirectory · Issue #3207 · refin...
Describe the bug I exactly followed your instructions on Serving the application from a subdirectory but it didn&#39;t work. Another person who I believe is a core team member confirmed that it...