Reputation: 637
In my app, I am using Marionette the extension of Backbone. I installed backbone + marionette with using NPM and Browserify. I am getting as a first error as :
Uncaught TypeError: Cannot read property 'extend' of undefined
driver.js
require('./setup.js');
var Backbone = require('backbone');
var Marionette = require('backbone.marionette');
var TodoList = Backbone.Marionette.LayoutView.extend({
el: '#app-hook',
template: require('./app/templates/layout.html')
});
var todo = new TodoList({
model: new Backbone.Model({
items: [
{assignee: 'Scott', text: 'Write a book about Marionette'},
{assignee: 'Andrew', text: 'Do some coding'}
]
})
});
todo.render();
compile project with command browserify driver.js -t node-underscorify -o static/app.js Whithout errors.
Please any help me. Thank you.
Upvotes: 1
Views: 552
Reputation: 1525
Can you confirm the version of Marionette you are using? If it's version 3 LayoutView
was removed and you should use View
instead:
var TodoList = Backbone.Marionette.View.extend({
el: '#app-hook',
template: require('./app/templates/layout.html')
});
You can read about more changes in their upgrade guide.
Upvotes: 2