Durandal.js optimizer not working (empty main-built.js)

帅比萌擦擦* 提交于 2019-12-31 03:04:46

问题


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

Result is

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

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.

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

回答1:


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.



来源:https://stackoverflow.com/questions/16686822/durandal-js-optimizer-not-working-empty-main-built-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!