Swap underscore 1.8.3 for lodash 4.2.1 in the base puppet 2.4.4

Is it possible? Keep reading conflicting reports about this.

I have a Marionette app just updated to 2.4.4.

If I replace lodash instead of underscore - with 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 boots normally, only the puppet complains.

It looks like this context 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 tips?

+5
source share
1 answer

For everyone looking at this, the answer is no.

Lodash 3.10.1 great, but the 4.x release removed the context parameter from many of the functions that Marionette breaks.

The old way was

  _.each(collection, iteratee, context); 

New way

 _.each(collection, _.bind(iteratee, context)); 

But for now, everything is fine using 3.10.1 with the requireJS above.

So, until Marionette is updated, you should stop at 4.x

+8
source

Source: https://habr.com/ru/post/1242415/


All Articles