Вопрос

How to implement lodash with new version of BB 1.1.1 or 1.1.2, which has AMD wrapper? And how to exports Backbone into global scope, with requirejs?

1.1.0 - without amd wrapper, works good. Thnk's.

Это было полезно?

Решение 2

Having this in your config should work:

paths: {
    underscore: <path to lodash>,
    backbone: <path to backbone>,
    jquery: <path to jquery>
}

You must use a version of lodash that is compatible with Backbone. This is the one created with lodash backbone when you use the CLI. You do not need shims of any of these. Defining underscore so that it points to lodash will make Backbone use lodash.

Другие советы

If you have libraries that depend on lodash explicitly, such as lodash-template-loader, you will need to use this:

paths: {
    lodash: <path to lodash>,
    ....
},
map: {
  "*": {
    "underscore": "lodash"
  }
}

At that point, any dependency on underscore will load lodash instead, and the template loader will work.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top