Skip to content

Commit 1494b8e

Browse files
committed
Update asset handling and routing for console application
1 parent 234cfeb commit 1494b8e

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

apps/console/objectstack.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class PatchedHonoServerPlugin extends HonoServerPlugin {
6060
const path = require('path');
6161

6262
// Manual Asset Handler to ensure assets are served
63-
app.get('/assets/*', async (c: any) => {
64-
const filePath = path.join(path.resolve(staticRoot), c.req.path);
63+
app.get('/console/assets/*', async (c: any) => {
64+
const filePath = path.join(path.resolve(staticRoot), c.req.path.replace('/console', ''));
6565
if (fs.existsSync(filePath)) {
6666
const ext = path.extname(filePath);
6767
let contentType = 'application/octet-stream';
@@ -78,7 +78,7 @@ class PatchedHonoServerPlugin extends HonoServerPlugin {
7878
});
7979

8080
// Register fallback after serveStatic (which is added in listen/originalStart)
81-
app.get('*', async (c: any) => {
81+
app.get('/console/*', async (c: any) => {
8282
// Ignore API calls -> let them 404
8383
if (c.req.path.startsWith('/api')) {
8484
return c.text('Not Found', 404);

apps/console/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ import { ThemeProvider } from './components/theme-provider';
291291
export function App() {
292292
return (
293293
<ThemeProvider defaultTheme="system" storageKey="object-ui-theme">
294-
<BrowserRouter>
294+
<BrowserRouter basename="/console">
295295
<Routes>
296296
<Route path="/apps/:appName/*" element={<AppContent />} />
297297
<Route path="/" element={<RootRedirect />} />

apps/console/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import path from 'path';
44

55
// https://vitejs.dev/config/
66
export default defineConfig({
7+
base: '/console/',
78
define: {
89
'process.env': {},
910
'process.platform': '"browser"',

0 commit comments

Comments
 (0)