In a Backbone.Marionette web app, I copied a view resource from one view to another and I'm getting the unexpected token error when the web app loads up. The view definition is like what you see below, I'm just moving one of the view definitions from this page to another definition page (a Marionette.Layout)
define([
'app',
'lib/underscore',
'lib/backbone',
'lib/backbone.marionette',
'lib/Backbone.ModalDialog',
'lib/alertify',
'text!modules/header/templates/mytemplate.html',
'modules/header/views/another',
'modules/header/views/andanother'],
function(App, _, Backbone, Marionette, btm, alertify, template, AnotherView, AndAnotherView) {
var MyView = Marionette.CompositeView.extend({
...
Previously I tracked down this type of error to a mistyped route; fixing the route solved the issue but that doesn't appear to be the issue here. There the error was because the framework was attempting to render JSON into a template but was getting an html formatted error message instead of data.
The notification is coming from alertify in the global error handler; you don't get a stack trace in the handler, see this discussion: When will proper stack traces be provided on window.onError function?
I can step through to the error (deep through framework callbacks), but everything seems fine until the error fires, even the content that is about to be rendered.