Typescript tsconfig 排除一些源文件
Typescript tsconfig to exclude some source files
我正在尝试让 Typescript 在编译时排除某些文件。但是,它似乎并不想排除它们。
这是我的tsconfig.json
{
"ref": "master",
"path": "typings",
"compilerOptions": {
"module": "amd",
"target": "es5",
"declaration": true,
"sourceMap": true,
"outDir": "build/src"
},
"exclude": [
"node_modules",
"typings/global",
"typings/index.d.ts",
"./src/subClassA.ts"
],
"files": [
"./src/entry.ts"
]
}
似乎排除了 node_modules 和打字。但是编译后的代码,仍然包含 subClassA.
我原以为编译后的代码没有任何来自 subClassA 的代码,但它确实有。
Any files that are referenced by files included via the "files" or
"include" properties are also included. Similarly, if a file B.ts is
referenced by another file A.ts, then B.ts cannot be excluded unless
the referencing file A.ts is also specified in the "exclude" list.
如果您的 ./src/entry.ts
文件或 ./src/entry.ts
的任何依赖项在某处使用 ./src/subClassA.ts
,则无法排除 ./src/subClassA.ts
,除非 ./src/entry.ts
也被排除。
我正在尝试让 Typescript 在编译时排除某些文件。但是,它似乎并不想排除它们。
这是我的tsconfig.json
{
"ref": "master",
"path": "typings",
"compilerOptions": {
"module": "amd",
"target": "es5",
"declaration": true,
"sourceMap": true,
"outDir": "build/src"
},
"exclude": [
"node_modules",
"typings/global",
"typings/index.d.ts",
"./src/subClassA.ts"
],
"files": [
"./src/entry.ts"
]
}
似乎排除了 node_modules 和打字。但是编译后的代码,仍然包含 subClassA.
我原以为编译后的代码没有任何来自 subClassA 的代码,但它确实有。
Any files that are referenced by files included via the "files" or "include" properties are also included. Similarly, if a file B.ts is referenced by another file A.ts, then B.ts cannot be excluded unless the referencing file A.ts is also specified in the "exclude" list.
如果您的 ./src/entry.ts
文件或 ./src/entry.ts
的任何依赖项在某处使用 ./src/subClassA.ts
,则无法排除 ./src/subClassA.ts
,除非 ./src/entry.ts
也被排除。