File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ export const serveCommand = new Command('serve')
255255 console . warn ( chalk . yellow ( ` ⚠ @objectstack/studio not found — skipping UI` ) ) ;
256256 } else if ( hasStudioDist ( studioPath ) ) {
257257 const distPath = path . join ( studioPath , 'dist' ) ;
258- await kernel . use ( createStudioStaticPlugin ( distPath ) ) ;
258+ await kernel . use ( createStudioStaticPlugin ( distPath , { isDev } ) ) ;
259259 trackPlugin ( 'StudioUI' ) ;
260260 } else {
261261 console . warn ( chalk . yellow ( ` ⚠ Studio dist not found — run "pnpm --filter @objectstack/studio build" first` ) ) ;
Original file line number Diff line number Diff line change @@ -240,7 +240,7 @@ export function createStudioProxyPlugin(vitePort: number) {
240240 * Uses Node.js built-in fs for static file serving to avoid external
241241 * bundling dependencies.
242242 */
243- export function createStudioStaticPlugin ( distPath : string ) {
243+ export function createStudioStaticPlugin ( distPath : string , options ?: { isDev ?: boolean } ) {
244244 return {
245245 name : 'com.objectstack.studio-static' ,
246246
@@ -271,8 +271,11 @@ export function createStudioStaticPlugin(distPath: string) {
271271 `$1="${ STUDIO_PATH } /` ,
272272 ) ;
273273
274- // Redirect root and bare path to Studio
275- app . get ( '/' , ( c : any ) => c . redirect ( `${ STUDIO_PATH } /` ) ) ;
274+ // In dev mode, redirect root to Studio for convenience
275+ if ( options ?. isDev ) {
276+ app . get ( '/' , ( c : any ) => c . redirect ( `${ STUDIO_PATH } /` ) ) ;
277+ }
278+ // Redirect bare path
276279 app . get ( STUDIO_PATH , ( c : any ) => c . redirect ( `${ STUDIO_PATH } /` ) ) ;
277280
278281 // Serve static files with SPA fallback
You can’t perform that action at this time.
0 commit comments