我刚开始使用 require.js,并且将以下 app.js 文件作为我的主干应用程序的一部分:
require.config({
baseUrl: "/js/",
paths: {
jquery: 'libs/jquery-2.1.0',
underscore: 'libs/underscore-min',
backbone: 'libs/backbone-min'
},
shim: {
underscore: {
exports: "_"
},
backbone: {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
},
}
});
在我的 index.html 文件的标签中,我放置了以下内容:
define(['underscore', 'backbone'], function (_, Backbone) {
但是,我的 index.html 文件出现以下错误:
Uncaught ReferenceError: Backbone is not defined
我的 require.js 文件中包含以下内容:
Uncaught Error: Mismatched anonymous define() module: function (_, Backbone) {
有什么线索吗?