@@ -68,41 +68,53 @@ const vuetify = createVuetify({
6868 try {
6969 console . log ( ' 📁 Fetching custom-questions-config.json' ) ;
7070 const configResponse = await fetch ( '/custom-questions-config.json' ) ;
71+
72+ console . log ( ` 🔍 Config fetch response status: ${ configResponse . status } ` ) ;
73+ console . log ( ` 🔍 Config fetch response URL: ${ configResponse . url } ` ) ;
74+
7175 if ( configResponse . ok ) {
7276 console . log ( ' ✅ Custom questions config file found' ) ;
7377 const customConfig = await configResponse . json ( ) ;
7478 console . log ( ' 📋 Custom config parsed:' , customConfig ) ;
79+
7580 if ( customConfig . hasCustomQuestions && customConfig . importPath ) {
7681 console . log ( `🎨 Studio Mode: Loading custom questions from ${ customConfig . packageName } ` ) ;
7782 console . log ( ` 📦 Import path: ${ customConfig . importPath } ` ) ;
83+
7884 try {
79- const customModule = await import ( customConfig . importPath ) ;
85+ console . log ( ' 🔄 Attempting dynamic import...' ) ;
86+ const customModule = await import ( /* @vite -ignore */ customConfig . importPath ) ;
8087 console . log ( ' ✅ Custom module imported successfully' ) ;
88+ console . log ( ' 🔍 Module exports:' , Object . keys ( customModule ) ) ;
89+
8190 customQuestions = customModule . allCustomQuestions ?.( ) ;
8291 if ( customQuestions ) {
8392 console . log (
8493 ` ✅ Loaded custom questions: ${ customQuestions . questionClasses ?. length || 0 } types`
8594 ) ;
8695 console . log ( ' 📊 Custom questions object:' , customQuestions ) ;
8796 } else {
88- console . log ( ' ⚠️ Custom module did not return questions data' ) ;
97+ console . error ( ' ❌ FATAL: Custom module did not return questions data!' ) ;
98+ console . error ( ' 🔍 allCustomQuestions result:' , customQuestions ) ;
99+ console . error ( ' 🔍 allCustomQuestions function:' , customModule . allCustomQuestions ) ;
89100 }
90101 } catch ( importError ) {
91- console . warn (
92- ` ⚠️ Failed to import custom questions: ${ importError instanceof Error ? importError . message : String ( importError ) } `
93- ) ;
102+ console . error ( ' ❌ FATAL: Failed to import custom questions module!' ) ;
103+ console . error ( ' 🔍 Import path attempted:' , customConfig . importPath ) ;
104+ console . error ( ' 🔍 Error:' , importError ) ;
105+ throw importError ; // Re-throw to make it visible
94106 }
95107 } else {
96- console . log (
97- ' ℹ️ Custom config exists but hasCustomQuestions is false or importPath is missing'
98- ) ;
108+ console . warn ( ' ⚠️ Config exists but hasCustomQuestions is false or importPath is missing' ) ;
109+ console . warn ( ' 🔍 Config content:' , customConfig ) ;
99110 }
100111 } else {
101- console . log ( ' ℹ️ Custom questions config file not found (this is normal)' ) ;
112+ console . warn ( ` ⚠️ Custom questions config not found (HTTP ${ configResponse . status } )` ) ;
113+ console . warn ( ` 🔍 Attempted URL: ${ configResponse . url } ` ) ;
102114 }
103115 } catch ( configError ) {
104- // No custom questions config - this is normal for default studio mode
105- console . log ( ' ℹ️ No custom questions config available (default studio mode)' ) ;
116+ console . error ( ' ❌ Error fetching custom questions config:' , configError ) ;
117+ // Don't throw - missing config is valid for non-custom courses
106118 }
107119
108120 // Register custom question types in CourseConfig if available
@@ -164,17 +176,29 @@ const vuetify = createVuetify({
164176 ) ;
165177 }
166178
167- // Build custom courseware registry
168- const { allCourseWare, AllCourseWare } = await import ( '@vue-skuilder/courseware' ) ;
169- const studioCourseWare = customQuestions
170- ? new AllCourseWare ( [ ...allCourseWare . courses , ...customQuestions . courses ] )
171- : allCourseWare ;
172-
173- // Store custom courseware for use in components
174- app . provide ( 'studioCourseWare' , studioCourseWare ) ;
179+ // Register custom courses with the allCourseWare singleton
180+ console . log ( '🎨 Studio Mode: Registering custom courses' ) ;
181+ const { allCourseWare } = await import ( '@vue-skuilder/courseware' ) ;
182+ console . log ( ` 🔍 allCourseWare instance:` , allCourseWare ) ;
183+ console . log ( ` 🔍 Current courses BEFORE registration:` , allCourseWare . courses . map ( c => c . name ) ) ;
184+
185+ if ( customQuestions ?. courses ) {
186+ console . log ( ` 📦 Registering ${ customQuestions . courses . length } custom course(s)` ) ;
187+ console . log ( ` 📦 Custom courses to register:` , customQuestions . courses . map ( c => c . name ) ) ;
188+ customQuestions . courses . forEach ( ( course ) => {
189+ // Check if already registered to avoid duplicates
190+ if ( ! allCourseWare . courses . find ( ( c ) => c . name === course . name ) ) {
191+ allCourseWare . courses . push ( course ) ;
192+ console . log ( ` ✅ Registered course: ${ course . name } ` ) ;
193+ } else {
194+ console . log ( ` ℹ️ Course ${ course . name } already registered` ) ;
195+ }
196+ } ) ;
197+ console . log ( ` 🔍 Current courses AFTER registration:` , allCourseWare . courses . map ( c => c . name ) ) ;
198+ }
175199
176200 console . log ( '🎨 Studio Mode: Collecting view components' ) ;
177- const viewComponents = studioCourseWare . allViewsRaw ( ) ;
201+ const viewComponents = allCourseWare . allViewsRaw ( ) ;
178202 console . log ( ` ✅ Collected ${ Object . keys ( viewComponents ) . length } base view components` ) ;
179203
180204 // Add custom question view components if available
0 commit comments