requirejs:模块名称“下划线”尚未加载上下文
当我刚刚加载我的应用程序时,我总是收到此错误,
Error: Module name "underscore" has not been loaded yet for context: _. Use require([]) http://requirejs.org/docs/errors.html#notloaded ...,h){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.re... require.js (line 8) TypeError: Backbone.Model is undefined var ProjectModel = Backbone.Model.extend({
但是当我点击浏览器上的刷新按钮时它们就消失了。
有谁知道为什么? 我该如何解决?
这是我的config / main / entry js文件,
require.config({ //By default load any module IDs from js/lib baseUrl: 'js', paths: { jquery: 'lib/jquery/jquery-min', underscore: 'lib/underscore/underscore-min', backbone: 'lib/backbone/backbone-min', text: 'lib/text/text' }, shim: { jquery: { exports: '$' }, underscore: { exports: '_' }, backbone: { exports: 'Backbone' } } }); require([ // Load our app module and pass it to our definition function 'app', 'jquery', 'underscore', 'backbone', // Pull in the Collection module. 'collection/contacts' ], function(App){ // The "app" dependency is passed in as "App" App.initialize(); });
我错过了什么吗?
试试这个:
shim: { jquery: { exports: '$' }, underscore: { deps:["jquery"], exports: '_' }, backbone: { deps:["jquery"], exports: 'Backbone' } }
- 如何在Marionette .js + backbone中加载html文件?
- 点击后触发骨干事件或按回车键
- Backbone.js Collection和Tastypiefilter
- 谷歌地图 – 未捕获的TypeError:无法设置未定义的属性“位置”
- Backbone.js:执行Fetch()后,只渲染新模型
- 未捕获的SyntaxError:无法在’Document’上执行’querySelector’
- 如何使用带有backbone.js和require.js的Jquery-file-upload
- Backbone / Marionette CollectionView – 渲染内部模板?
- Backbone.js`model.destroy()`自定义转换?