2013-05-22 25 views
2

我试图让Durandal.js优化器在我的测试项目上工作,但它似乎没有为main-built.js生成任何内容。我使用下面的命令从命令的node.js提示,在迪朗达尔/ AMD文件夹:Durandal.js优化器不工作(empty main-built.js)

optimizer.exe --verbose true 

结果是

Using default base configuration. 
Configuring for deploy with almond (custom). 
{ 
    "name": "durandal/amd/almond-custom", 
    "inlineText": true, 
    "stubModules": [ 
    "durandal/amd/text" 
    ], 
    "paths": { 
    "text": "durandal/amd/text" 
    }, 
    "baseUrl": "C:\\Users\\Tommi Gustafsson\\Documents\\Visual Studio 2012\\Projects\\DurandalTests\\DurandalTest1\\TestApp", 
    "mainConfigFile": "C:\\Users\\Tommi Gustafsson\\Documents\\Visual Studio 2012\\Projects\\DurandalTests\\DurandalTest1\\TestApp\\main.js", 
    "include": [ 
    "main-built", 
    "main", 
    "bindings/tinymce-binding", 
    "durandal/app", 
    "durandal/composition", 
    "durandal/events", 
    "durandal/http", 
    "text!durandal/messageBox.html", 
    "durandal/messageBox", 
    "durandal/modalDialog", 
    "durandal/system", 
    "durandal/viewEngine", 
    "durandal/viewLocator", 
    "durandal/viewModel", 
    "durandal/viewModelBinder", 
    "durandal/widget", 
    "durandal/plugins/router", 
    "durandal/transitions/entrance", 
    "raphael-amd/eve.0.3.4", 
    "raphael-amd/raphael.2.1.0.amd", 
    "raphael-amd/raphael.2.1.0.core", 
    "raphael-amd/raphael.2.1.0.svg", 
    "raphael-amd/raphael.2.1.0.vml", 
    "viewmodels/flickr", 
    "viewmodels/modal1", 
    "viewmodels/myPage", 
    "viewmodels/shell", 
    "viewmodels/welcome", 
    "text!views/detail.html", 
    "text!views/flickr.html", 
    "text!views/modal1.html", 
    "text!views/myPage.html", 
    "text!views/shell.html", 
    "text!views/welcome.html" 
    ], 
    "exclude": [], 
    "keepBuildDir": true, 
    "optimize": "uglify2", 
    "out": "C:\\Users\\Tommi Gustafsson\\Documents\\Visual Studio 2012\\Projects\\DurandalTests\\DurandalTest1\\TestApp\\main-built.js", 
    "pragmas": { 
    "build": true 
    }, 
    "wrap": true, 
    "insertRequire": [ 
    "main" 
    ] 
} 
Deleting old output file. 

Tracing dependencies for: durandal/amd/almond-custom 

然后,当我检查主built.js,它是空的。任何人都可以帮助我解决问题吗?测试项目中有几个AMD模块,包括Raphael.js AMD模块。

我requirejs配置是这样的:

requirejs.config({ 
    paths: { 
     'text': 'durandal/amd/text', 
     'eve': './raphael-amd/eve.0.3.4', 
     'raphael.core': './raphael-amd/raphael.2.1.0.core', 
     'raphael.svg': './raphael-amd/raphael.2.1.0.svg', 
     'raphael.vml': './raphael-amd/raphael.2.1.0.vml', 
     'raphael': './raphael-amd/raphael.2.1.0.amd', 
     'tinymce': "../Scripts/tinymce/jquery.tinymce.min" 
    } 
}); 

回答

4

在同AMD的文件夹,其中优化存储,尝试运行node r.js -o app.build.js。我见过r.js有时会窒息一些依赖关系,通过require.js加载时可以毫无问题地解决问题。无论出于何种原因,使用optimizer --verbose时都不会显示错误消息。通常,错误消息提供了足够的信息来查看发生这种情况的位置以及是否需要更新require.contig.paths或特定的define依赖关系。

+0

感谢这个Rainer,它帮我找到了它为什么不起作用。给出错误,我在一个'旧'文件夹中引用一个.js文件,我正在使用那里我不再加载该文件(愚蠢的人类技巧) –