resolvePath moved to a method and default.js extension added if none present