Durandal.js优化器不起作用(空的main-built.js) [英] Durandal.js optimizer not working (empty main-built.js)

查看:93
本文介绍了Durandal.js优化器不起作用(空的main-built.js)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让Durandal.js优化程序在我的测试项目中运行,但似乎对main-built.js不会产生任何影响。我在durandal / amd文件夹中的node.js命令提示符下使用以下命令:

I'm trying to get Durandal.js optimizer working on my test project, but it seems to generate nothing to main-built.js. I use the following command from node.js command prompt, in durandal/amd folder:

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模块。

Then, when I check main-built.js, it is empty. Can anyone help me what is the problem? I have several AMD modules in the test project, including Raphael.js AMD modules.

我的requirejs配置看起来像这样:

My requirejs configuration looks like this:

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"
    }
});


推荐答案

在存储优化工具的同一amd文件夹中,尝试运行 node r.js -o app.build.js 。我见过 r.js 有时会为某些依赖项而烦恼,通过 require.js 加载时可以毫无问题地解决。无论出于何种原因,使用 optimizer --verbose 时都不会显示错误消息。通常,错误消息会提供足够的信息,以查看发生此情况的位置以及是否必须更新 require.contig.paths 或特定的定义依赖性。

In the same amd folder, where optimizer is stored, try running node r.js -o app.build.js. I've seen r.js sometimes choke about some dependencies, which resolves without problem when loading via require.js. For whatever reason the error messages won't show up when using optimizer --verbose. Typically the error message provides enough information to see where this occurs and if you've to update require.contig.paths or a specific define dependency.

这篇关于Durandal.js优化器不起作用(空的main-built.js)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆