I think I must have had a typo or something... the example now works... now going to something more sophisticated... (too big for here...) but I think i've tracked it down to a bug in one of my other modules...
https://github.com/jimklo/TheCollector/blob/master/dataservices/thecollector-resources/views/lib/sig_utils.js#L47 Is there some way to debug 'requires'? There's no real error other that someobject.someexportedfunction doesn't exist. Hence I'm not able to figure out what's wrong with the library since I needed to 'hack' it a bit to export the objects I needed access. FWIW: I've got what I need to work prototyped in SpiderMonkey here: https://gist.github.com/3036199 now trying to translate to CouchDB with this project. (DCH: This might interest you... I recall you asking me about OpenPGP inside Map Reduce...) Thanks, - Jim Jim Klo Senior Software Engineer Center for Software Engineering SRI International On Jul 2, 2012, at 6:52 PM, Alexander Shorin wrote: Hi! Your case works for me for 1.2.0 release and 1.3.0@master. What result you got? -- ,,,^..^,,, On Tue, Jul 3, 2012 at 5:38 AM, Jim Klo <[email protected]<mailto:[email protected]>> wrote: Hi, I have a question regarding CommonJS within views.. Should this work, or is it a bug that it doesn't? Using CouchDB 1.2.0 { _id: "_design/commonjs-test", views: { lib: { include1: "var include2 = require('views/lib/include2'); exports.foo1 = include2.foo2;", include2: "exports.foo2 = 42" }, my_view: { map: "function(doc) { emit( require('views/lib/include1').foo1, null); }" } } } If it should work what might I be doing wrong? Thanks, Jim Klo Senior Software Engineer Center for Software Engineering SRI International
