Very basic Backbone/Underscore via Require.js issue driving me batty

后端 未结 5 1287
没有蜡笔的小新
没有蜡笔的小新 2021-01-30 18:35

I am attempting to implement an EXTREMELY basic test that uses jquery, underscore.js and backbone.js loaded via require.js and for some reason I just cannot seem to get everythi

5条回答
  •  误落风尘
    2021-01-30 19:22

    I had the same problem. Actually I found that you do not need an AMD compliant Backbone or Underscore, or require-jquery or anything else (e.g. !order). All you need to do to is have app defined in paths and than set its dependencies in shim :). Somehow it used to work without it in the past.

    paths: {
        app:'app',
        jquery: '../libs/jquery/jquery.1.9.1.min',
        underscore: '../libs/underscore/underscore.min',
        backbone: '../libs/backbone/backbone.min', 
        // ...
    },
    shim: {
     "app": {
          deps: ['jquery','underscore','backbone'],
          exports: 'app'  
    },
    "backbone": {
      deps: ['jquery','underscore'],
      exports: 'Backbone'  
    },
    "underscore": {
      exports: '_'
    }
    //...
    

    }

提交回复
热议问题