Angular + Requirejs - ładowanie w niewłaściwej kolejności

Próbuję załadować angular i jquery z requirejs. Najlepsze, co mogę zrobić, to to, że 50% czasu, w którym wszystko ładuje się poprawnie, druga połowa to błądNo Module: mainApp

Zakładam, że jest to złamanie połowy czasu w oparciu o szybkość, z jaką requirejs ładuje skrypty.

Kiedy to działa, widzę test „Hello World” (chociaż widzę, że {{text}} flashuje przed jego zastąpieniem, ale czytałem, jak to naprawić tutaj). Przez resztę czasu pojawia się błąd i {{text}} po prostu pozostaje na ekranie.

Github Repo

Tree:

index.html
- js
    - libs
        require.js
    - modules
        mainApp.js
    main.js

main.js

require.config({
  paths: {
    'jQuery': '//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min',
    'angular': '//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular',
  },
  shim: {
    'angular' : {'exports' : 'angular'},
    'jQuery': {'exports' : 'jQuery'}
  }
});

require(['jQuery', 'angular', 'modules/mainApp'] , function ($, angular, mainApp) {
  $(function () { // using jQuery because it will run this even if DOM load already      happened
    angular.bootstrap(document, ['mainApp']);
  });
});

modules/mainApp.js

define(['angular'], function (angular) {
  return angular.module('mainApp' , []).controller('MainCtrl', ['$scope', function ($scope) {
      $scope.text = 'Hello World';
  }]);
});

Relevant index.html

<head>
    <script src="js/libs/require.js" data-main="js/main"></script>
</head>
<body>
    <div ng-app="mainApp">
        <div ng-controller="MainCtrl">
            {{text}}
        </div>
    </div>
</body>

questionAnswers(3)

yourAnswerToTheQuestion