File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
packages/react-server/lib/plugins/file-router Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -771,7 +771,10 @@ export default function viteReactServerRouter(options = {}) {
771771 config . build . rollupOptions . input [ join ( "static" , hash ) ] =
772772 staticSrc ;
773773 paths . push ( async ( ) => {
774- const staticPaths = ( await import ( exportEntry ) ) . default ;
774+ let staticPaths = ( await import ( exportEntry ) ) . default ;
775+ if ( typeof staticPaths === "function" ) {
776+ staticPaths = await staticPaths ( ) ;
777+ }
775778 if ( typeof staticPaths === "boolean" && staticPaths ) {
776779 if ( / \[ [ ^ \] ] + \] / . test ( path ) ) {
777780 throw new Error (
@@ -782,23 +785,16 @@ export default function viteReactServerRouter(options = {}) {
782785 }
783786 return { path } ;
784787 }
785- if ( typeof staticPaths === "function" ) {
786- return await staticPaths ( ) ;
787- }
788788 const validPaths = await Promise . all (
789789 staticPaths . map ( async ( def ) => {
790790 let obj = def ;
791791 if ( typeof def === "function" ) {
792792 obj = await def ( ) ;
793793 }
794- try {
795- return { path : applyParamsToPath ( path , obj ) } ;
796- } catch ( e ) {
797- if ( typeof obj . path === "string" ) {
798- return { path : obj . path } ;
799- }
800- throw e ;
794+ if ( typeof obj . path === "string" ) {
795+ return { path : obj . path } ;
801796 }
797+ return { path : applyParamsToPath ( path , obj ) } ;
802798 } )
803799 ) ;
804800 return validPaths ;
You can’t perform that action at this time.
0 commit comments