----- Original Message ----- > > I just want to know if one can import CommonJS modulesin Riak > > mapreduce > > or pre-commit hook function.
> Hi, Briche. I'm unfamiliar with how the CommonJS modules are > structured, but if they're available as a simple collections of .js > files, you can have Riak load them at startup by following the > directions given here: > https://help.basho.com/entries/321385-how-do-i-load-3rd-party-javascript-libraries-for-use-in-map-reduce-functions#overview > (essentially: toss the files in a directory, and point to it by > setting 'js_source_dir' in the riak_kv section of your app.config) Sorry to barge in, but I don't think it's as simple as all that. :) CommonJS has a specification about how modules are structured that needs to be followed so that the appropriate stuff is registered correctly. http://www.commonjs.org/specs/modules/1.0/ To have "proper" commonjs support in Riak, one would need to bootstrap modules so that the right "require" and "exports" is defined at the right time. I pretty sure you can't just make sure commonjs modules are available to the JS interpreter because you don't want every module available all the time. The idea is that you have some bootstrap mechanism to load the right JS modules when you need them. Some M/R jobs would need module X while other M/R jobs would need module Y. Quite possibly you don't want both modules X and Y available all the time to all jobs. Clear as mud? :) Thanks! Jon Brisbin http//jbrisbin.com
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com