Using lodash instead of underscore in Backbone.js application

Up to version 2.4.1, lodash published a "Underscore compatible" version.

https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.underscore.js

You can use that as a drop-in replacement.

As of 3.0, they removed this build.

Removed the underscore build

https://github.com/lodash/lodash/wiki/Changelog


If you are using Browserify, check out Browserify Swap or Aliasify

Personally I use Browserify Swap. Example package.json usage:

  "browserify": {
    "transform": [
      "browserify-swap"
    ]
  },
  "browserify-swap": {
    "@packages": [
      "underscore"
    ],
    "all": {
      "underscore.js$": "lodash"
    }
  }