Handle resolving modules as directories and modules as .json files.