Best way to define module for both node and client <p>I'm trying to write a small module that I want to be available both on the Browser and Node.js environment.</p> <p>So far I've come up with the following</p> <pre><code>(exports &amp;&amp; window = exports) (function(global){ // make it available to either exports OR window depending on the environment global.Awesome = function() { } })(window) </code></pre> <p>is that sufficient or is there any better way to do this? Thanks in advance.</p>