I have a web project
I have folders
src/app/shared/models
src/app/shared/services
src/app/shared/types
Each one of those is subfolder that have folders or files inside it, I want to exclude those folders, So i tried:
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts",
"src/app/shared/**/*"
]
and its not working, even "src/app/shared/*"
not working, How I can do it?
My tsconfig.json now:
{
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2015",
"dom"
]
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts",
"src/app/shared/**/*"
]
}
Thanks
The include and exclude properties take a list of glob-like file patterns. The supported glob wildcards are: * matches zero or more characters (excluding directory separators) ? matches any one character (excluding directory separators)
json file. The exclude array contains filenames or patterns that should be skipped when resolving the include array. The exclude option changes what the include option finds, effectively filtering out some folders or files from compilation.
TypeScript includes a default set of type definitions for built-in JS APIs (like Math ), as well as type definitions for things found in browser environments (like document ).
The first thing to consider, if you decide to use the “exclude
” keyword to list files is that, in order to remove them from the compilation process, you will need also to exclude any other files, which by using either a triple-slash directive "/// <reference path="..." />
" or an "import
" statement refer to a file in your excluded list.
tsconfig.json
turns a folder into a “project”. Without specifying any “exclude
” or “files
” entries, all files in the folder containing the tsconfig.json
and all its sub-directories are included in your compilation.
tsconfig.json
automatic inclusion does not embed module resolution. If the compiler identified a file as a target of a module import, it will be included in the compilation regardless if it was excluded in the previous steps.
The
include
andexclude
properties take a list of glob-like file patterns. The supported glob wildcards are:
*
matches zero or more characters (excluding directory separators)?
matches any one character (excluding directory separators)**/
recursively matches any subdirectoryWhen using the
files
property it takes a list of relative or absolute file paths.
Setting "baseUrl
" informs the compiler where to find modules. All module imports with non-relative names are assumed to be relative to the baseUrl.
Files included using "include
" can be filtered using the "exclude
" property. However, if you include files explicitly using the "files
" property they would be always included regardless of "exclude
".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With