Is this even possible? Keep reading conflicting reports on this.
I have a Marionette app, just upgraded to 2.4.4.
If I drop in lodash in place of underscore - using requireJS,
map: {
'*': {
'underscore': 'lodash'
}
},
// 'underscore':'/resource/vendor/backbone.marionette/underscore',
'lodash':'/resource/vendor/lodash/lodash.min',
I get the following error...
Uncaught TypeError: Cannot read property 'vent' of undefined
lodash is loading up ok, just marionette is complaining.
It appears that the context this
on line 466
is undefined
463 _proxyMethods: function() {
464 _.each([ "vent", "commands", "reqres" ], function(system) {
465 _.each(messageSystems[system], function(method) {
466 this[system][method] = proxyMethod(this, system, method);
467 }, this);
468 }, this);
469 }
Any advice?
Because Lodash is updated more frequently than Underscore. js, a lodash underscore build is provided to ensure compatibility with the latest stable version of Underscore.
Lodash's API is a superset of Underscore. It provides every functionality that Underscore does, along with a few additional helpful functions such as AMD support, deep clone, and deep merge.
That's just a name. A short name, used for namespacing the library. lodash can be considered a fork of the underscore, a light version of underscore.
For anyone else looking at this, the answer is no.
Lodash 3.10.1
is fine, but the 4.x
release has removed the context
option from many of the functions, which breaks Marionette
.
The old way was
_.each(collection, iteratee, context);
The new way is
_.each(collection, _.bind(iteratee, context));
But so far so good with using 3.10.1
with the above requireJS set up.
So until Marionette
is updated, you have to hold off on 4.x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With