2013-05-22 47 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文件,我正在使用那裏我不再加載該文件(愚蠢的人類技巧) –