Durandal.js优化器不工作(空main-built.js)

时间:2013-05-22 08:19:11

标签: durandal

我正在尝试让Durandal.js优化器处理我的测试项目,但似乎没有为main-built.js生成任何东西。我在node.js命令提示符下的durandal / amd文件夹中使用以下命令:

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

然后,当我检查main-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"
    }
});

1 个答案:

答案 0 :(得分:4)

在存储优化程序的同一个amd文件夹中,尝试运行node r.js -o app.build.js。我已经看到r.js有时会对某些依赖关系感到困惑,这些依赖关系在通过require.js加载时无解决。无论出于何种原因,使用optimizer --verbose时都不会显示错误消息。通常,错误消息会提供足够的信息以查看发生这种情况的位置以及是否要更新require.contig.paths或特定的define依赖项。