@@ -157,18 +157,17 @@ export function exportFunctions({
157157 __filename,
158158 exports,
159159 functionDirectoryPath = './' ,
160- searchGlob = './ **/*.js' ,
160+ searchGlob = '**/*.js' ,
161161 funcNameFromRelPath = funcNameFromRelPathDefault ,
162162 enableLogger = false ,
163163 logger = console ,
164164 extractTrigger = getTriggerFromModule ,
165165 __dirname,
166166} : ExportFunctionsConfig ) {
167167 const log = enableLogger ? logger : disabledLogger ;
168- const cwd = resolve ( __dirname ?? getDirnameFromFilename ( __filename ) , functionDirectoryPath ) ;
169-
168+ const cwd = resolve ( __dirname ?? getDirnameFromFilename ( __filename ) , functionDirectoryPath ) ; /* ? */
170169 log . time ( dirSearchMsg ) ;
171- const files = glob . sync ( searchGlob , { cwd } ) ;
170+ const files = glob . sync ( searchGlob , { cwd } ) ; /* ? */
172171 log . timeEnd ( dirSearchMsg ) ;
173172
174173 const moduleSearchMsg = `[better-firebase-functions] Search for Module '${ getFunctionInstance ( ) } '` ;
@@ -177,10 +176,11 @@ export function exportFunctions({
177176
178177 // eslint-disable-next-line no-restricted-syntax
179178 for ( const file of files ) {
180- const funcName = funcNameFromRelPath ( file ) ; /* ? */
179+ const absPath = resolve ( cwd , file ) ;
180+ const standardRelativePath = absPath . substr ( cwd . length + 1 ) ; /* ? */
181+ const funcName = funcNameFromRelPath ( standardRelativePath ) ; /* ? */
181182 if ( isDeployment ( ) || funcNameMatchesInstance ( funcName ) ) {
182183 if ( ! isDeployment ( ) ) log . timeEnd ( moduleSearchMsg ) ;
183- const absPath = resolve ( cwd , file ) ;
184184 if ( absPath . slice ( 0 , - 2 ) === __filename . slice ( 0 , - 2 ) ) continue ; // Prevent exporting self
185185
186186 if ( ! isDeployment ( ) ) log . time ( coldModuleMsg ) ;
0 commit comments