2

我正在尝试让 Durandal.js 优化器在我的测试项目上工作,但它似乎对 main-built.js 没有任何影响。我在 durandal/amd 文件夹中的 node.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

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

1 回答 1

4

在存储优化器的同一个 amd 文件夹中,尝试运行node r.js -o app.build.js. 我r.js有时会看到一些依赖项令人窒息,通过require.js. 无论出于何种原因,使用optimizer --verbose. 通常,错误消息提供了足够的信息来查看发生这种情况的位置以及您是否需要更新require.contig.paths或特定define依赖项。

于 2013-05-22T21:21:33.143 回答