File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -103,9 +103,24 @@ try {
103103 // Get the directory of the current module
104104 const __filename = fileURLToPath ( import . meta. url ) ;
105105 const __dirname = path . dirname ( __filename ) ;
106- const customConfigPath = path . join ( __dirname , 'custom.config.mjs' ) ;
107106
108- if ( fs . existsSync ( customConfigPath ) ) {
107+ // Try multiple possible locations for custom.config.mjs
108+ // 1. Same directory as config-loader.mjs (works in dev)
109+ // 2. Process working directory (works in build/preview)
110+ const possiblePaths = [
111+ path . join ( __dirname , 'custom.config.mjs' ) ,
112+ path . join ( process . cwd ( ) , 'custom.config.mjs' ) ,
113+ ] ;
114+
115+ let customConfigPath = null ;
116+ for ( const possiblePath of possiblePaths ) {
117+ if ( fs . existsSync ( possiblePath ) ) {
118+ customConfigPath = possiblePath ;
119+ break ;
120+ }
121+ }
122+
123+ if ( customConfigPath ) {
109124 // Use dynamic import with file:// URL to prevent static analysis by Vite/Rollup
110125 const customConfigUrl = pathToFileURL ( customConfigPath ) . href ;
111126 const customModule = await import ( customConfigUrl ) ;
You can’t perform that action at this time.
0 commit comments