Fix discovery of modules in "lib"

`./lib` was only working when running local examples, we need `__dirname` when this is used as an NPM module.