strongloop/loopback-boot — pull request #55 by bitmage (2014-10-14 06:01:43+00:00)
Title: Coffee fix

coffee-script files (or any other custom extensions for 'require') will not be loaded if there is a JSON file in the same location. This is because of the load order:

http://nodejs.org/api/modules.html#modules_all_together

Custom extensions get tried only after the builtin ones have been exhausted.

My fix is to take the list of files which had already been obtained, and filter it to exclude .json files, and any files that don't match the basename. I then take the first matching file and try a require.resolve on it.