AMD Module Loading Error with Mustache using RequireJS

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 04:09:12

In you main.js file where you have all you're requires, make sure to add Mustache to the config, and don't worry about the wrapper and just try loading Mustache directly.

require.config({ 
    'paths': { 
        "underscore": "libs/underscore", 
        "backbone": "libs/backbone",
        "Mustache": "libs/mustache/mustache"
    }
}); 

That might help...

Also, here are some starter apps to help you out on your require, backbone journey.

https://github.com/jcreamer898/RequireJS-Backbone-Starter
https://github.com/david0178418/BackboneJS-AMD-Boilerplate
https://github.com/addyosmani/backbone-fundamentals
https://github.com/amdjs

Clone the repository from github:

$ git clone https://github.com/janl/mustache.js.git

Then, build the RequireJS specific version of the library:

$ rake requirejs

Use the resulting file 'requirejs.mustache.js' as your mustache library.

Use Twitter's mustache repository!

Here is what worked for me (Ubuntu 12.04):

sudo apt-get install rake ruby-rspec
git clone git://github.com/twitter/mustache.js.git
cd mustache.js/
rake requirejs
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!