【发布时间】:2019-02-13 16:04:42
【问题描述】:
我需要正则表达式来添加到 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
【问题讨论】:
-
您使用特定的编程语言吗?到目前为止,您尝试了什么?
-
Javascript。当前使用“/**/*.ts”
-
那不是正则表达式。 tsconfig 没有“排除”部分吗? "xx/x.spec.ts" 其中 x 是 *
-
您尝试过类似
"/**/*!(*spec.ts)"的方法吗?如果您使用的是glob,则有一个ignore section 可以排除文件。 -
"但没有运气" 你确定它不起作用吗?也许它需要从较早的运行中进行一些整理。