Angular 角度2-t配置输出方向
我目前正在开发Angular2应用程序,我面临以下问题-我的项目中有一些单元测试,我不希望它们与我的其他代码一起发送到/dist文件夹。我的项目结构如下:Angular 角度2-t配置输出方向,angular,typescript,tsc,tsconfig,Angular,Typescript,Tsc,Tsconfig,我目前正在开发Angular2应用程序,我面临以下问题-我的项目中有一些单元测试,我不希望它们与我的其他代码一起发送到/dist文件夹。我的项目结构如下: dist/ -app (compiled from src/app) -test (compiled from src/test) src/ -app -test 现在,我使用tsconfig.json中的“outDir”将所有.js文件编译到/dist目录。我想做的只是编译所有app/ts文件并将它们发送到/dist目录,但将编译
dist/
-app (compiled from src/app)
-test (compiled from src/test)
src/
-app
-test
现在,我使用tsconfig.json中的“outDir”将所有.js文件编译到/dist目录。我想做的只是编译所有app/ts文件并将它们发送到/dist目录,但将编译后的.js文件从我的/test目录保留在那里。应该是这样的:
dist/
-app (compiled from src/app)
src/
-app
-test ( all compiled js files remain here )
有什么想法吗
谢谢您可以尝试以下方法:
- src/
- app/
- test/
- tsconfig.json
- tsconfig.json
tsconfig.json
forsrc/
{
"compilerOptions": {
"outDir": "../dist"
[...]
},
"exclude": [],
"include": ["./app"]
[...]
}
tsconfig.json
fortest/
{
"compilerOptions": {
"outDir": "./"
[...]
},
"extends": "../tsconfig.json",
"include": ["./"]
[...]
}
编译代码时要小心,您必须运行两次tsc
。
- 从
文件夹,编译应用程序代码src
- 从
文件夹中,编译测试test