title: Windows Universal JavaScript runtime error: 'WinJS' is undefined
body: <p>I've this app created with cordova/ionic and angularjs. It's using google maps etc. I managed to make a working windows phone 10 build in VS2015 last week and today was going to make release build but surprise mf it just had stopped working for no apparent reason. Started giving me WinJS undefined. My index.html header looks like this before build:</p>
  
  <pre><code>    &lt;script src="cordova.js"&gt;&lt;/script&gt;
      &lt;script src="js/ionic.bundle.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/requirejs/require.js"&gt;&lt;/script&gt;
      &lt;script src="js/app.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>and while debugging DOM explorer shows this header</p>
  
  <pre><code>    &lt;script src="cordova.js"&gt;&lt;/script&gt;
      &lt;script src="/www/WinJS/js/base.js"&gt;&lt;/script&gt;
      &lt;script src="js/ionic.bundle.min.js"&gt;&lt;/script&gt;
      &lt;script src="ms-appx-web://companyName.appName/www/cordova_plugins.js"&gt;&lt;/script&gt;
      &lt;script src="js/requirejs/require.js"&gt;&lt;/script&gt;
      &lt;script src="js/app.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>so WinJs seems to be included. By inspecting <em>cordova.js</em> with breakpoints I can see that window.WinJS is undefined and script is added with:</p>
  
  <pre><code>    if (!window.WinJS) {
          var scriptElem = document.createElement("script");
  
          if (navigator.appVersion.indexOf('MSAppHost/3.0') !== -1) {
              // Windows 10 UWP
              scriptElem.src = '/www/WinJS/js/base.js';
       ...}
       scriptElem.addEventListener("load", onWinJSReady);
       document.head.appendChild(scriptElem);
  </code></pre>
  
  <p>and it still crashes at this point</p>
  
  <pre><code>    var onWinJSReady = function () {
          var app = WinJS.Application;
          .... }
  </code></pre>
  
  <p>I've seen similar problems here and there but those are for windows phone 8.1. I've no clue anymore what is going on here. My W10 phone updated itself just before the app broke but I doubt it's just coincidence(?) </p>