I'm trying to include the App instance to use it's event aggregator as shown here
I get an error when I include the instance in a view.
Kicking things off in the Requirejs config file, from App.Bootloader.js:
require(['App'], function (App){
      App.start();
      });
from App.js:
define(function (require){
  //...requisite includes $, _, Backbone, Marionette ...
var Layout = require('Layout');
  var App = new Marionette.Application();
        App.addRegions({
            main: '#view_content'
        });
        App.addInitializer(function (){
                App.main.show(new Layout());
                //... adding router etc ...    
                Backbone.Marionette.TemplateCache.loadTemplate = function (template, callback){
                   callback.call(this, Handlebars.compile(template));
                };
                Backbone.history.start();
        });
    return App;
});
From Layout.js:
define(function(require){
   var View = require('folder/folder/View');
   //template contains #sub div
   var template = require('text!template.html');
   return Marionette.Layout.extend({
      template: template,
      regions: {
         sub: '#sub'
      },
      initialize: function(){
         //wait till template is rendered in dom
         _.defer(function(region){
             region.sub.show(new View());
          }, this)
      }
   });
});
From /folder/folder/View.js:
define(function (require){
      //...requisite includes $, _, Backbone, Marionette ...
     var App = require('App');
     return Marionette.ItemView.extend({});
});
Where I get the error "'Error: Module name 'App' has not been loaded yet for context: _"
Any ideas? Lemme know if you need more information.
 
     
     
     
    