Resolving with package metadata and improve legacy browserify field check.

Same as #24, cleaned up by running:

```
git checkout -b resolve-with-pkg-metadata
git diff resolve-with-pkg-metadata dir-replace-2 > patchfile
patch -p1 < patchfile 
```