Okey,

Scenario is this: There is two competing libraries for ”_” (aka. underscore) global variable. Libraries in question are ”underscore” and ”lodash”. Problem is that due to javascript compatibility dependency hell, it’s quite difficult to have only one of them.

For example. in simple test project (either using Jam or Bower) I’m failing to accomplish target.

Case 1: Jam
Jam insists on getting underscore, no clear easy way around it. Hmm… not good, jam is using its’ own customized version of require.js. Well, that ain’t really good, I don’t whole black box, I just want dependency management.

Case 2: Bower
Same issue seemingly here. Actually I had here get slightly newer version of ”backbone.layoutmanager”, which is seemingly breaking my deck. Notes for 0.8.x version of this library states that ”Lo-Dash is no longer supported, use the lodash.underscore build instead.”. Okey, no problem, wait…, there ain’t ”lodash.underscore” available via Bower. Oh, duh, hitting dead end.

Thus even if lodash is supposedly ”better” than underscore, mixing these two libraries concurrently can pose issues.

Btw, situation ain’t helped by the fact that there is at least two different backbone versions in Bower:

  1. backbone (apparently backbone with underscore dependency)
  2. backbone-amd-lodash (apparently backbone with AMD and lodash dependency)

This really makes me to miss standard Java JDK libraries, which could be also easily extended without global dependency mess. I guess so this is called ”progress” (aka. reinventing wheel in 10 year cycles).

Enough of that, now back to editor to figure out how I can command Bower. At first impression, Bower feels better than Jam. Primarily because it doesn’t try to make ”do it all” blackbox, but simply ”fetch defined dependencies”. Which means that I’ve control over how actual require.js config is done. No fighting against the will of Jam.

References:
The State of Javascript Package Management

/ Javascript, Web

Vastaa

Sähköpostiosoitettasi ei julkaista. Pakolliset kentät on merkitty *

This site uses Akismet to reduce spam. Learn how your comment data is processed.