【发布时间】:2020-05-11 02:09:24
【问题描述】:
我想通过将 *.ts 文件添加到 tsconfig.json 的“排除”属性中来从编译中排除它。尽管如果我确实在代码中的某处导入该文件,它会忽略排除并编译它。如何强制 TS 排除该文件?
../
../must_be_excluded.ts
../index.ts
使用导入
//index.ts
import {some_stuff} from "./must_be_excluded"
Tsconfig 设置
//tsconfig.json
{
"compilerOptions": {...},
"exclude": ["./must_be_excluded.ts"]
}
我还是看到了 must_be_excluded.js!
【问题讨论】:
-
需要更多数据。为什么要排除?我看到的任何需要这样做的情况都可以通过将一些代码移动到另一个文件来解决。
标签: typescript import