title: Namespaces in node.js with require
body: <p>I am playing around and learning about vows with a personal project. This is a small client side library, with testing done in vows. Therefore, I must build and test a file that is written like this:</p>
  
  <pre><code>(function(exports) { 
      var module = export.module = { "version":"0.0.1" }; 
      //more stuff
  })(this);
  </code></pre>
  
  <p>In my testing (based off of <a href="https://github.com/jasondavies/science.js/">science.js</a>, d3, etc.) requires that module like so: </p>
  
  <pre><code>require("../module");
  </code></pre>
  
  <p>I continued to get a "module not defined error" when trying to run the tests, so I went to a repl and ran: </p>
  
  <pre><code>require("../module")
  </code></pre>
  
  <p>and it returned:</p>
  
  <pre><code>{ module: { version: "0.0.1" } }
  </code></pre>
  
  <p>I realize I could do something like:</p>
  
  <pre><code>var module = require("../module").module;
  </code></pre>
  
  <p>but feel like I am creating a problem by doing it that way, especially since the libraries that I based this project on are doing it in the format I described.</p>
  
  <p>I would like for my project to behave similar to those which I based it off of, where:</p>
  
  <pre><code>require("../module");
  </code></pre>
  
  <p>creates a variable in this namespace:</p>
  
  <pre><code>module.version; //is valid.
  </code></pre>
  
  <p>I have seen this in a variety of libraries, and I am following the format and thought process to the T but believe I might be missing something about require behavior I don't know about.</p>