假设我将我的代码放在 src
下,测试放在 spec
下:
+ spec
+ --- classA.spec.ts
+ src
+ --- classA.ts
+ --- classB.ts
+ --- index.ts
+ tsconfig.json
我想只传送 src
到 dist
文件夹。由于 index.ts
是我的包的入口点,我的 tsconfig.json
看起来像这样:
{
"compileOptions": {
"module": "commonjs"
"outDir": "dist"
},
"files": {
"src/index.ts",
"typings/main.d.ts"
}
}
但是,这个 tsconfig.json
不包含测试文件,因此我无法解析它们中的依赖项。
另一方面,如果我将测试文件包含到 tsconfig.json
中,那么它们也会被转移到 dist
文件夹中。
How do I solve this problem?