@@ -101,11 +101,25 @@ const defaultConfig = {
101101// Try to load custom config (optional, for forks)
102102let customConfig = { } ;
103103try {
104- const customModule = await import ( './custom.config.mjs' ) ;
105- customConfig = customModule . default || customModule || { } ;
104+ // Check if file exists before importing
105+ const fs = await import ( 'node:fs' ) ;
106+ const path = await import ( 'node:path' ) ;
107+ const { fileURLToPath, pathToFileURL } = await import ( 'node:url' ) ;
108+
109+ // Get the directory of the current module
110+ const __filename = fileURLToPath ( import . meta. url ) ;
111+ const __dirname = path . dirname ( __filename ) ;
112+ const customConfigPath = path . join ( __dirname , 'custom.config.mjs' ) ;
113+
114+ if ( fs . existsSync ( customConfigPath ) ) {
115+ // Use dynamic import with file:// URL to prevent static analysis by Vite/Rollup
116+ const customConfigUrl = pathToFileURL ( customConfigPath ) . href ;
117+ const customModule = await import ( customConfigUrl ) ;
118+ customConfig = customModule . default || customModule || { } ;
119+ }
106120} catch ( error ) {
107- // custom.config.mjs doesn't exist, use defaults only
108- // This is expected for the default repository
121+ // custom.config.mjs doesn't exist or couldn't be loaded , use defaults only
122+ // This is expected for the default repository or when file is missing
109123}
110124
111125// Deep merge function for nested objects
0 commit comments