durandal optimizer references wrong path when building it as a post build process in Visual Studio

守給你的承諾、 提交于 2019-12-04 02:00:27

问题


i set up a post-build event in visual studio to use durandal's optimizer (which uses nodejs) to build the main-built.js file for production. getting an error saying it can't find main-built.js. i believe this is because it's not referencing my project properly. my base directory is at c:\projects\myapp\myapp. it's only looking for the durandal directory from c:\projects\myapp.

is there a way to tell it the correct directory?

here's some of the output.

if 'Release'=='Release' C:\Projects\myapp\myapp\\App\durandal\amd\optimizer.exe
  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:\\Projects\\myapp",
    "mainConfigFile": "C:\\Projects\\myapp\\main.js",
    "include": [
      "packages/Durandal.1.1.0/content/App/durandal/app",
         ...etc...
    ],
    "exclude": [],
    "keepBuildDir": true,
    "optimize": "uglify2",
    "out": "C:\\Projects\\myapp\\main-built.js",
    "pragmas": {
      "build": true
    },
    "wrap": true,
    "insertRequire": [
      "main"
    ]
  }

回答1:


i found out that even tho it's pointing to the wrong place, i can change it by using the --source attribute on optimizer.

the fix was to use the source attribute and point it to the base directory of the durandal files in the post-build event.

in my case, it looked like this:

if '$(Configuration)'=='Release' $(ProjectDir)\App\durandal\amd\optimizer.exe --source c:\projects\myapp\myapp\app

'app' being the root of the durandal files and folders.



来源:https://stackoverflow.com/questions/15684040/durandal-optimizer-references-wrong-path-when-building-it-as-a-post-build-proces

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