문제

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