2
我有一個使用通過require.js +文本插件underscore.js模板和加載它們的應用程序:從requirejs優化剔除模板
define([..., 'text!templates/app/authentication.html'], function(..., Template) {
...
});
所有工作正常,但現在我要來連接我所有的js文件到Grunt.js和require.js優化器。以下是繁重的文件的相應部分:
requirejs: {
compile: {
options: {
name : 'main',
baseUrl: "www/js",
optimize: "none",
out: "www/js/result.js",
stubModules : ['text'],
paths : {
text: 'vendor/text',
...
},
shim: {
...
}
}
}
}
但咕嚕拋出我的下一個錯誤:
Running "requirejs:compile" (requirejs) task
>> Tracing dependencies for: nexusapp
>> Error: ENOENT, no such file or directory
>> 'D:\templates\app\authentication.html'
>> In module tree:
>> main
>> app
>> app.authentication
>> text
Warning: RequireJS failed. Use --force to continue.
Aborted due to warnings.
優化試圖讀取文件忽略指定baseUrl
。 我該如何解決這個問題?
預先感謝您!