Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

backbone 1.1.2, marionette, requirejs, min version

Need help. https://github.com/serheyShmyg/requirejs-jquery-backbone

This is my boilerplate. Try install it. Before install: 1. change backbone version from 1.1.0 to 1.1.2(latest with amd wrapper); in bower.json. 2. app/jade/layouts/_footer.jade - uncoment Production version, and comment Development. Like this

//-Production
script(src="../js/lib/requirejs/require.js", data-main="../js/main.min.js")
//-Development
//-script(src="../js/lib/requirejs/require.js", data-main="../js/config.js")

Install: npm install

Go localhost:8080/markup/ and get in console Uncaught ReferenceError: Backbone is not defined backbone.marionette.js:35

Can't understand why backbone loading with amd wrapper so long, and marionette can't find Backbone global var.

Its only with backbone 1.1.2 or 1.1.1, this version got AMD wrapper. And only in min. version of js.

Guys help! Thank's!

like image 933
Serhey Avatar asked Apr 01 '26 17:04

Serhey


1 Answers

There was a pretty big change made in Backbone from 1.1.0 to 1.1.1: it registers itself as an AMD module (see http://backbonejs.org/#changelog).

To get your optimization working, you probably need to set the wrapShim option to true (see http://requirejs.org/docs/api.html).

You can see an example (from my book on using RequireJS) here: https://github.com/davidsulc/structuring-backbone-with-requirejs-and-marionette/blob/master/assets/js/build.js#L7

like image 172
David Sulc Avatar answered Apr 03 '26 17:04

David Sulc