使用Asp.Net Core1.0和Tyescript2.0,我试图将所有生成的javascript连接到一个文件(site.js)的根上。我的目录结构是:
Site
--wwwroot\
----site.js
--typings\
--tsconfig.json我看过tsconfig.json 模式文档了。我玩过"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核心服务于www.root。以下是完整的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"
]
}发布于 2016-12-06 19:18:52
根据这类型的脚本问题,outDir被自动排除在源代码之外,这有一定的意义,我只是希望有某种警告。定义问题中的wwwroot源于使用对类型目录的三重斜杠引用。
/// <reference path="../../typings/moment.d.ts" />,这导致计算出的公共root.Switching ( outDir )生成了
define("services/MessengerService"我想要的输出结果。
https://stackoverflow.com/questions/40998693
复制相似问题