After compiling in advanced mode, and running Node, `require("./parinfer.js")` just returns {}. Adding the `:target :nodejs` option doesn't help.
I'm thinking it has something to do with google closure renaming my `module` symbol despite having the externs to prevent it. Anyway to prevent this?
my advice would be to use a post-process step instead of trying to making it go through the closure compiler. Not only will that produce headaches but the generated CLJS->JS also does not match the expected structure for UMD exports.
You'd need to tag the functions you want to have available by name ala
(defn ^:export js-indent-mode []...)
and then refer to them on the exports. Note that you need to refer to the munged names (eg. _ instead of -).
I do not know how to do this in cljsbuild but could show you an example in shadow-build if interested. Anyways all you'd need is to pipe the compiled output into the below script (at the marker). No externs needed for this case.
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.returnExports = factory();
}
}(this, function () {
// CLJS-COMPILED-OUTPUT-HERE
return {indentMode: parinfer.api_js.js_indent_mode,
indentModeChange: parinfer.api_js.js_indent_mode_change,
parenMode: parinfer.api_js.js_paren_mode};
}));
HTH,
/thomas