I had used returnExports pattern defined in https://github.com/umdjs/umd to get a module that works in Node, AMD and browser globals. That repo has several patterns and tools for this and you may find useful to solve your usecase.
Thanks Santhosh _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l