title: Module not defined
body: <p>I'm learning Javascript and Node and I am trying to create a module that extends String. First I got the error require is not defined so I started using requireJS. Then I got this error <code>NS_ERROR_DOM_BAD_URI: Access to restricted URI denied</code> so I moved <code>project.html</code> into the same folder as my <code>.js</code> files. Now I am getting module not defined in <code>require.js</code> and I can't seem to figure out why. I've read through some other posts but I didn't find a solution. My file structure looks like this</p>
  
  <blockquote>
    <ul>
    <li>strip/
    
    <ul>
    <li>scripts/</li>
    <li>main.js</li>
    <li>require.js</li>
    <li>project.html</li>
    <li>helper/
    
    <ul>
    <li>extendString.js</li>
    </ul></li>
    </ul></li>
    </ul>
  </blockquote>
  
  <p><strong>main.js</strong></p>
  
  <pre><code>define(function(require, exports, module){
    var StringHelperModule = require("helper/extendString.js");
    StringHelperModule.extendString(String);
  
    var tmp = 'Hello World'.strip(' ');
    document.write(tmp);
    //Outputs: HelloWorld
  });
  </code></pre>
  
  <p><strong>extendString.js</strong></p>
  
  <pre><code>'use strict';
  module.exports = function extendString(String){
    String.prototype.strip = function (delimiter) {
      return this.replace(delimiter, '');
    };
  };
  </code></pre>
  
  <p><strong>project.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
     &lt;head&gt;
        &lt;script data-main='main' src='require.js'&gt;&lt;/script&gt;
     &lt;/head&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>require.js</strong> </p>
  
  <pre><code>(function () {
      // Separate function to avoid eval pollution, same with arguments use.
      function exec() {
          eval(arguments[0]); //This is line the error points to
      }
  
      require.load = function (context, moduleName, url) {
          var xhr = new XMLHttpRequest();
  
          xhr.open('GET', url, true);
          xhr.send();
  
          xhr.onreadystatechange = function () {
              if (xhr.readyState === 4) {
                  exec(xhr.responseText);
  
                  //Support anonymous modules.
                  context.completeLoad(moduleName);
              }
          };
      };
  }());
  </code></pre>
  
  <p>I'm also getting not well-formed before it says module not defined if that has anything to do with this </p>