正则表达式匹配ts文件但不测试

问题描述 投票:0回答:1

我需要正则表达式添加到tsconfig文件。我试图只匹配ts源文件,但不匹配测试文件。

尝试过类似的事情;

  "include": [
    "src/**/*",
    "../../node_modules/@web/common/src/app/views/**/*.ts"
    "../../node_modules/@web/common/src/app/views/**/*.(module|component).ts"
  ],
  "exclude": [
    "node_modules",
    "**/*.spec.ts",
    "../../**/*.spec.ts"

但没有运气。

// should match
/main.ts
/hello-world.component.ts

// shouldn't match
/hello-world.component.spec.ts
/app.e2e-spec.ts
regex tsc tsconfig
1个回答
0
投票

tsconfig文件有一个exclude部分,用于根据模式匹配排除文件。例如:

"include": [
        "src/**/*"
    ],
    "exclude": [
        "node_modules",
        "**/*.spec.ts"
    ]

the handbook

© www.soinside.com 2019 - 2024. All rights reserved.