Prevent infinity loop on resolvePath for malformed paths

`resolvePath` was looping forever for paths like `src/index.html/src/index.js`