Fix requireJS preload config module

Fix problem caused using requireJS on which sbt/config is not loaded if there is not a module explicitly requiring it.

Also added a more robust error check on Endpoint.find()