问题描述
我已经使用Angular 快速入门示例作为我的angular 2的开始应用.我目前正在尝试在单独的目录中编译文件,以免将 .ts
和 .js
文件混为一谈,而我却没有办法提出的工具.
I've used Angular Quickstart example as a beginning for my angular 2 application. I'm currently trying to compile files in a separate directory to avoid the mess of .ts
and .js
files being mixed and I didn't a way to do it with the tools proposed.
我想知道在切换到常规gulp/grunt编译之前是否有人遇到过这个问题.
I would like to know if anyone has met the problem before switching to a regular gulp/grunt compilation.
推荐答案
我遇到了同样的问题.看看这个问题有人提出来.链接到Github问题
I had this same problem. Check it out in this issue someone raised. Link to Github issue
只需在 tsconfig.json
中指定目录(outDir),如下所示.
Simply specify the directory (outDir) in tsconfig.json
like shown below.
{
"version": "1.7.3",
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"removeComments": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noEmitOnError": false,
"preserveConstEnums": true,
"inlineSources": false,
"sourceMap": false,
"outDir": "./dist",
"rootDir": "./src",
"project": "./src",
"moduleResolution": "node",
"listFiles": false
},
"exclude": [
"node_modules",
"jspm_packages",
"typings/browser",
"typings/browser.d.ts"
]
}
这篇关于如何使用Angular Quickstart编译特定文件夹中的打字稿文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!