diff --git a/packages/dev-utils/src/devApp/render.tsx b/packages/dev-utils/src/devApp/render.tsx index f39a1ebb0e..768e0973e6 100644 --- a/packages/dev-utils/src/devApp/render.tsx +++ b/packages/dev-utils/src/devApp/render.tsx @@ -86,6 +86,15 @@ class DevAppBuilder { // Build and render directory to #root element render(): void { const DevApp = this.build(); + + const paths = this.findPluginPaths(this.plugins); + + if (window.location.pathname === '/') { + if (!paths.includes('/') && paths.length > 0) { + window.location.pathname = paths[0]; + } + } + ReactDOM.render(, document.getElementById('root')); } @@ -145,6 +154,20 @@ class DevAppBuilder { return registry; } + + private findPluginPaths(plugins: BackstagePlugin[]) { + const paths = new Array(); + + for (const plugin of plugins) { + for (const output of plugin.output()) { + if (output.type === 'route') { + paths.push(output.path); + } + } + } + + return paths; + } } // TODO(rugvip): Figure out patterns for how to allow in-house apps to build upon