File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
packages/db/src/core/navigators Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,25 @@ export abstract class ContentNavigator implements StudyContentSource {
2828 strategyData : ContentNavigationStrategyData
2929 ) : ContentNavigator {
3030 const implementingClass = strategyData . implementingClass ;
31- const NavigatorImpl = require ( `./${ implementingClass } .ts` ) . default ;
31+ let NavigatorImpl ;
32+
33+ // Try different extension variations
34+ const variations = [ '' , '.ts' , '.js' ] ;
35+
36+ for ( const ext of variations ) {
37+ try {
38+ NavigatorImpl = require ( `./${ implementingClass } ${ ext } ` ) . default ;
39+ break ; // Break the loop if loading succeeds
40+ } catch ( e ) {
41+ // Continue to next variation if this one fails
42+ console . log ( `Failed to load with extension ${ ext } :` , e ) ;
43+ }
44+ }
45+
46+ if ( ! NavigatorImpl ) {
47+ throw new Error ( `Could not load navigator implementation for: ${ implementingClass } ` ) ;
48+ }
49+
3250 return new NavigatorImpl ( user , course , strategyData ) ;
3351 }
3452
You can’t perform that action at this time.
0 commit comments