title: TypeScript with require.js and jquery does not work on production server (require.js Script Error)
body: <p>I recently started looking into TypeScript. I am using require.js to load the modules. Currently I am only loading jquery, but this will obviously be expanded.</p>
  
  <p>My project setup is as followed:</p>
  
  <pre><code>app
    &gt; classes
       &gt; Greeter.ts
    &gt; AppConfig.ts
    &gt; AppMain.ts
  lib
    &gt; jquery-1.7.2.js
    &gt; require.js
  modules
    &gt; jquery.d.ts
    &gt; require.d.ts
  app.ts
  default.htm
  </code></pre>
  
  <p><strong>AppConfig.ts</strong></p>
  
  <pre><code>/// &lt;reference path="../modules/require.d.ts" /&gt;
  /// &lt;reference path="AppMain.ts" /&gt;
  
  require.config({
      baseUrl: '../',
      paths: {
          'jquery': 'lib/jquery-1.7.2'
      }, 
      shim: {
          jquery: {
              exports: '$'
          }
      }
  });
  
  require(['jquery','app/AppMain'], 
      ($, main) =&gt; {
          // code from window.onload
          var appMain = new main.AppMain();
          appMain.run();
  });
  </code></pre>
  
  <p><strong>AppMain.ts</strong></p>
  
  <pre><code>import gt = module("app/classes/Greeter");
  
  export class AppMain {
      public run() {
          var el = document.getElementById('CONTENT_PH');
          var greeter = new gt.Greeter(el);
          greeter.start();
      }
  }
  </code></pre>
  
  <p><strong>Greeter.ts</strong></p>
  
  <pre><code>export class Greeter {
      element: HTMLElement;
      span: HTMLElement;
      timerToken: number;
  
      constructor (element: HTMLElement) { 
          this.element = element;
          this.element.innerText += "The time is: ";
          this.span = document.createElement('span');
          this.element.appendChild(this.span);
          this.span.innerText = new Date().toUTCString();
      }
  
      start() {
          this.timerToken = setInterval(() =&gt; this.span.innerText = new Date().toUTCString(), 500);
      }
  
      stop() {
          clearTimeout(this.timerToken);
      }
   }
  </code></pre>
  
  <p><strong>.csproj</strong></p>
  
  <pre><code>&lt;PropertyGroup Condition="'$(Configuration)' == 'Debug'"&gt;
      &lt;TypeScriptSourceMap&gt; --module AMD&lt;/TypeScriptSourceMap&gt;
    &lt;/PropertyGroup&gt;
    &lt;Target Name="BeforeBuild"&gt;
      &lt;Message Text="Compiling TypeScript files" /&gt;
      &lt;Message Text="Executing tsc$(TypeScriptSourceMap) @(TypeScriptCompile -&gt;'&amp;quot;%(fullpath)&amp;quot;', ' ')" /&gt;
      &lt;Exec Command="tsc$(TypeScriptSourceMap) @(TypeScriptCompile -&gt;'&amp;quot;%(fullpath)&amp;quot;', ' ')" /&gt;
    &lt;/Target&gt;
  </code></pre>
  
  <p>I got a few examples working on my local machine, but when I try to run it on a live server it gives the following Script Error from require.js.</p>
  
  <blockquote>
    <p>Error: Script error <a href="http://requirejs.org/docs/errors.html#scripterror" rel="nofollow">http://requirejs.org/docs/errors.html#scripterror</a>
        [Break On This Error]<br>
        var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
        require.js (line 194)</p>
  </blockquote>
  
  <p>I have no idea why this works on my developing machine, but not on a live server. </p>
  
  <p>Running this example locally works in chrome and internet explorer, but not in firefox. But this might be another issue.</p>
  
  <p>If you need additional details please let me know.</p>