[英]Exclude folder when compiling typescript
I use Atom to write code.我使用 Atom 编写代码。 It uses
tsconfig.json
to include and exclude folders.它使用
tsconfig.json
来包含和排除文件夹。 In order to use intellisense I need node_modules
to be included, but when I want to compile it to js
I don't want node_modules
to be compiled.为了使用智能感知,我需要包含
node_modules
,但是当我想将它编译为js
时,我不想编译node_modules
。 So I need to call tsc
in the upper folder where the config.ts
is, and this results in compiling the whole node_modules
.所以我需要在
config.ts
所在的上层文件夹中调用tsc
,这会导致编译整个node_modules
。
My folder structure looks like this:我的文件夹结构如下所示:
node_modules
config.ts
spec
|--test1.ts
|--test2.ts
Any idea how to exclude node_modules
when compiling with tsc
command?知道如何在使用
tsc
命令编译时排除node_modules
吗?
Use exclude property使用排除属性
{
"compilerOptions": {
...
}
"exclude": [
"node_modules"
]
}
Files included using "include" can be filtered using the "exclude" property.
使用“include”包含的文件可以使用“exclude”属性进行过滤。 However, files included explicitly using the "files" property are always included regardless of "exclude".
但是,无论“排除”如何,始终包含使用“文件”属性显式包含的文件。 The "exclude" property defaults to excluding the node_modules, bower_components, jspm_packages and directories when not specified.
当未指定时,“exclude”属性默认排除 node_modules、bower_components、jspm_packages 和目录。
link updated: https://www.typescriptlang.org/tsconfig#exclude链接更新: https ://www.typescriptlang.org/tsconfig#exclude
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.