substack/node-browserify — pull request #927 by ForbesLindesay (2014-10-01 15:17:37+00:00)
Title: Add type check for `opts.basedir`

If you pass a non-undefined, non-string to opts.basedir, the error you get out looks like:

```
TypeError: Arguments to path.resolve must be strings
at exports.resolve (path.js:313:15)
at exports.relative (path.js:370:20)
at Browserify._createDeps.mopts.resolve (/Users/forbeslindesay/GitHub/browserify-middleware/node_modules/browserify/index.js:349:37)
at /Users/forbeslindesay/GitHub/browserify-middleware/node_modules/browserify/node_modules/browser-resolve/index.js:188:13
at module.exports.cb (/Users/forbeslindesay/GitHub/browserify-middleware/node_modules/browserify/node_modules/resolve/lib/async.js:38:25)
at module.exports.cb (/Users/forbeslindesay/GitHub/browserify-middleware/node_modules/browserify/node_modules/resolve/lib/async.js:65:30)
at module.exports.isFile (/Users/forbeslindesay/GitHub/browserify-middleware/node_modules/browserify/node_modules/resolve/lib/async.js:23:18)
at Object.oncomplete (fs.js:107:15)
```

Which took me a while to figure out. It would be nice to just check it in the constructor of browserify.