下午好,
我正在尝试使用r.js优化基于Require.js和Backbone的源代码,但在编译过程中遇到以下错误:
Tracing dependencies for: main
Cannot optimize network URL, skipping: empty:.js
TypeError: Cannot read property 'normalize' of undefined
In module tree:
main
app
router
views/main_panel/event_details
helpers/template_manager我的template_manager模块不会尝试访问任何“规格化”属性,所以我并不真正理解这是什么意思。下面是我的应用程序的入口点以及require.js配置。
require.config({
paths: {
order: 'libs/requirejs-plugins/order',
text: 'libs/requirejs-plugins/text',
jQuery: 'libs/jquery/jquery',
Underscore: 'libs/underscore/underscore',
Backbone: 'libs/backbone/backbone',
templates: '../templates',
Sync: 'helpers/sync'
}
});
require([
'app',
'event_manager',
'order!https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',
'order!libs/underscore/underscore-min',
'order!libs/backbone/backbone-min',
'helpers/objects_extension',
'helpers/date_extension',
'helpers/assets'
], function(App){
App.initialize();
});应用程序本身或多或少遵循this tutorial中的内容。我的app.build.js文件如下
({
appDir: "../",
baseUrl: "js",
dir: "../app-build",
modules: [
{
name: "main"
}
],
paths: {
order: 'empty:',
text: 'empty:',
jQuery: 'empty:',
Underscore: 'empty:',
Backbone: 'empty:',
templates: '../templates',
Sync: 'helpers/sync'
}
})谢谢你的帮助。
发布于 2012-08-11 04:06:33
詹姆斯·伯克说:
文本插件需要由加载器加载才能处理文本!依赖性。加载器插件作为构建的一部分执行,以解析其资源。
因此,从路径config中删除文本"empty:“就足够了,只需保留excludes: in,这样它就不会包含在最终的构建结果中。这里假设您有本地可用的text.js供优化器读取。
https://stackoverflow.com/questions/11266808
复制相似问题