Backbone.Marionetteを使用して新しいアプリケーションを作成し、Expressアプリを実行してページをロードすると、コンソールでエラーが発生します。
Uncaught TypeError: Cannot read property 'EventAggregator' of undefined
backbone.marionette.js:1504
それが実際のmarionette
ライブラリにあることを示しています。私はその行を見てきました:
Marionette.EventAggregator = Backbone.Wreqr.EventAggregator;
wreqr
そして、それは私が追加しなければならない追加のライブラリかもしれないと思っていますか?
アプリを作成するコードは次のとおりです。
require([
'jquery',
'underscore',
'backbone',
'marionette'
], function( $, _, Backbone, Marionette ){
MyApp = new Backbone.Marionette.Application();
MyApp.addRegions({
main_region: '#main_region'
});
MyApp.addInitializer( function(options) {
var login_form_view = new LoginFormView();
});
});
ライブラリの場所を設定するrequireconfig:
// using RequireJS 1.0.7
require.config({
paths: {
'$': 'libs/jquery-1.8.2-min',
'underscore': 'libs/underscore-min', // AMD support
'backbone': 'libs/backbone.min', // AMD support
'bootstrap' : 'libs/bootstrap.min',
'marionette' : 'libs/backbone.marionette',
'wreqr' : 'libs/backbone.wreqr',
'templates': '../templates',
'text': 'libs/require/text',
'login': 'views/user/login'
}
});
エラーの原因を知っている人はいますか?