从生成的打字稿中的模块定义中删除 wwwroot javascript,即 define("wwwroot/services/

Remove wwwroot from module definition in typescript generated javascript, ie define("wwwroot/services/

使用 Asp.Net Core 1.0 和 Typescript 2.0 我试图将所有生成的 javascript 连接到 wwwroot 根目录下的单个文件 (site.js)。我的目录结构是:

Site
--wwwroot\
----site.js
--typings\
--tsconfig.json

我查看了 tsconfig.json schema docs。我玩过 "sourceRoot"、"rootDir"、"mapRoot" 和 "ourDir" 的不同组合,但似乎无法找出正确的组合。使用 "outDir" 似乎会导致它忽略我项目中的每个文件,只在 tsc 输出中列出以下文件:

C:/Users/shawn/AppData/Roaming/npm/node_modules/typescript/lib/lib.d.ts

生成的模块定义如下

define("wwwroot/services/MessengerService"

而且我希望他们以

的身份出现
define("services/MessengerService"

因为 asp.net 核心服务来自 wwwroot。以下完整 tsconfig.json:

{
  "compileOnSave": true,
  "compilerOptions": {
    "listFiles": true,
    "noImplicitAny": false,
    "noEmitOnError": false,
    "removeComments": true,
    "sourceMap": true,
    "pretty": true,
    "experimentalDecorators": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "moduleResolution": "classic",
    "target": "es5",
    "module": "amd",

    "sourceRoot": "wwwroot",
    "rootDir": "./wwwroot",
    "mapRoot": "wwwroot",

    "outFile": "wwwroot/site.js",


    "baseUrl": "wwwroot",
    "paths": {
      "file-drop": [ "typings/file-drop.d.ts" ]


    }
  },

  "exclude": [
    "node_modules",
    "wwwroot/ref",
    "wwwroot/lib",
    "typings"
  ]
}

根据 this 类型脚本问题,outDir 会自动从源代码中排除,这在一定程度上是有道理的,我只是希望有某种警告。定义问题中的 wwwroot 源于对 typings 目录使用三斜杠引用

/// <reference path="../../typings/moment.d.ts" />

导致计算出的公共 root.Switching outDir 变为 wwwroot/scripts 并删除所有三重斜杠引用生成

define("services/MessengerService"

我正在寻找的输出。