title: Uncaught ReferenceError: moment is not defined
body: <p>I'm trying to use <a href="http://momentjs.com/" rel="nofollow">moment.js</a> with <a href="https://github.com/jalaali/moment-jalaali" rel="nofollow">moment-jalaali.js</a> plugin.</p>
  
  <p>moment-jalaali is a plugin for moment js that adds support for jalaali (solar) calendar.</p>
  
  <p>Obviously in a web page one should first include moment.js then moment-jalaali.js in order to make it work.</p>
  
  <p>I'm doing it and it's giving me the <code>Uncaught ReferenceError: moment is not defined</code>. Google chrome says it's caused at line 31 at moment-jalaali.js :</p>
  
  <pre><code>require.modules = {
      moment: { exports: moment } // here the error happens
  };
  </code></pre>
  
  <p>I'm using these js libraries in nopcommerce (ASP.NET application) and I'm including them like the following in admin area layout:</p>
  
  <pre><code>Html.AppendScriptParts(string.Format("~/Scripts/kendo/{0}/kendo.web.min.js", kendoVersion));
  Html.AppendScriptParts("~/Scripts/admin.common.js");
  Html.AppendScriptParts("~/Scripts/jquery-migrate-1.2.1.min.js");
  Html.AppendScriptParts("~/Scripts/jquery-ui-1.10.3.custom.min.js");
  Html.AppendScriptParts("~/Scripts/jquery.validate.unobtrusive.min.js");
  Html.AppendScriptParts("~/Scripts/jquery.validate.min.js");
  Html.AppendScriptParts("~/Scripts/jquery-1.10.2.min.js");
  Html.AppendScriptParts("~/Scripts/moment.js");
  Html.AppendScriptParts("~/Scripts/moment-jalaali.js");
  </code></pre>
  
  <p>Even if I include them before everything else, it still does not work.</p>
  
  <p>Surprisingly if i make a simple html page like the following they work perfectly.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script src="moment.js"&gt;&lt;/script&gt;
      &lt;script src="moment-jalaali.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>What is causing the error and how can I fix it?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>If I include <code>moment-jalaali.js</code> in the <strong>View</strong> itself but still include <code>moment.js</code> in the <strong>Layout</strong> it works fine. However it's not a proper solution so I'm still looking for a better way.</p>