相关疑难解决方法(0)

使用spec/test文件夹设置tsconfig

假设我把我的代码放在下面src并测试spec:

+ spec
+ --- classA.spec.ts
+ src
+ --- classA.ts
+ --- classB.ts
+ --- index.ts
+ tsconfig.json
Run Code Online (Sandbox Code Playgroud)

我只想转发srcdist文件夹.既然index.ts是我的包的入口点,我的tsconfig.json样子如下:

{
  "compileOptions": {
    "module": "commonjs"
    "outDir": "dist"
  },
  "files": {
    "src/index.ts",
    "typings/main.d.ts"
  }
}
Run Code Online (Sandbox Code Playgroud)

但是,这tsconfig.json不包括测试文件,因此我无法解析其中的依赖项.

另一方面,如果我将测试文件包含在内,tsconfig.json那么它们也会被转换为dist文件夹.

我该如何解决这个问题?

typescript tsconfig visual-studio-code

43
推荐指数
3
解决办法
2万
查看次数

标签 统计

tsconfig ×1

typescript ×1

visual-studio-code ×1