我目前正在开发一个Angular2应用程序,我面临以下问题--我的项目中有一些单元测试,我不希望它们和我的其他代码一起发送到/dist文件夹。我的项目结构如下:
dist/
-app (compiled from src/app)
-test (compiled from src/test)
src/
-app
-test现在,使用tsconfig.json中的“tsconfig.json”,我正在将所有.js文件编译到/dist目录中。我想做的只是编译所有app/ ts文件并将它们发送到/dist目录,但是将编译后的.js文件从我的/test目录中保存下来。它应该是这样的:
dist/
-app (compiled from src/app)
src/
-app
-test ( all compiled js files remain here )有什么想法吗?
谢谢
发布于 2017-02-13 10:46:37
您可以尝试以下几种方法:
- src/
- app/
- test/
- tsconfig.json
- tsconfig.jsontsconfig.json for src/
{
"compilerOptions": {
"outDir": "../dist"
[...]
},
"exclude": [],
"include": ["./app"]
[...]
}tsconfig.json for test/
{
"compilerOptions": {
"outDir": "./"
[...]
},
"extends": "../tsconfig.json",
"include": ["./"]
[...]
}在编译代码时要小心,您必须运行两次tsc。
src文件夹编译应用程序代码。test文件夹编译测试。https://stackoverflow.com/questions/42200204
复制相似问题