【发布时间】:2016-02-25 19:54:27
【问题描述】:
我使用 Atom 作为带有 typescript 的 AngularJs 2 项目的开发环境。我在 atom 中添加了 atom-typescript 插件来支持 typescript。 Atom 正在为每个 .ts 文件生成单独的 .js 文件。我想为所有 .ts 文件生成单个 .js 文件。因此,我在 tsconfig.json 中的 comilerOptions 下添加了 outFile 设置。我的 tsconfig.json 如下。
{
"compilerOptions": {
"target": "ES5",
"module": "system",
"moduleResolution": "node",
"sourceMap": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outFile": "./js/Deployment/single.js"
},
"exclude": [
"node_modules"
]
}
看起来不错,但是当我编译项目时,它仍然会在指定位置生成空的 single.js 文件。我不明白我在这里缺少什么。我已经安装了 atom-typescript 8.2.0 版。
我的 package.json 如下。
{
"name": "Pro1",
"version": "1.0.0",
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.0",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"systemjs": "0.19.6",
"zone.js": "0.5.10"
},
"devDependencies": {
"concurrently": "^1.0.0",
"lite-server": "^1.3.1",
"typescript": "^1.7.3"
}
}
【问题讨论】:
-
你确定没有错误阻止它编译吗?
-
你使用的是什么版本的 tsc?
-
我使用的是 1.7.3。升级到 1.8 版本后,问题得到解决。谢谢大家及时回复。
标签: angularjs typescript atom-editor tsconfig