Glob support in tsconfig.json
Glob support is here!! Glob support has been one of the most requested features.
Glob-like file patterns are supported two properties "include"
and "exclude"
.
Example
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"outFile": "../../built/local/tsc.js",
"sourceMap": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
The supported glob wildcards are:
*
matches zero or more characters (excluding directory separators)?
matches any one character (excluding directory separators)*/
recursively matches any subdirectoryIf a segment of a glob pattern includes onlyor
.*
, then only files with supported extensions are included (e.g..ts
,.tsx
, and.d.ts
by default with.js
and.jsx
ifallowJs
is set to true).
If the "files"
and "include"
are both left unspecified, the compiler defaults to including all TypeScript (.ts
, .d.ts
and .tsx
) files in the containing directory and subdirectories except those excluded using the "exclude"
property. JS files (.js
and .jsx
) are also included if allowJs
is set to true.
If the "files"
or "include"
properties are specified, the compiler will instead include the union of the files included by those two properties.Files in the directory specified using the "outDir"
compiler option are always excluded unless explicitly included via the "files"
property (even when the “exclude
” property is specified).
Files included using "include"
can be filtered using the "exclude"
property.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
, and jspm_packages
directories when not specified.