Repository navigation
Glob support in tsconfig.json exclude array #10202
Copy link
Copy link
Closed
Labels
ExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.
Description
TypeScript Version:
2.0.0 installed with: npm install typescript@beta.
Also tried: npm install typescript@next same behavior
My Project structure
- node_modules/*
- src/*
- typings/*
My tsconfig.json
{
"compilerOptions": {
"module": "commons",
"outDir": "build",
"target": "es5",
"declaration": false,
"noImplicitAny": false,
"removeComments": false,
"sourceMap": false
},
"include": [
"typings/*",
"src/**/*.ts"
]
}
If I understood it right the exclude path is optional it should work just with include. Even when exclude is not present it is excluding node_modules.
TypeScript 2.0 Changelog
The "exclude" property defaults to excluding the node_modules, bower_components, and jspm_packages directories when not specified.
Expected behavior:
Typescript Compile without node_mpdules.
Actual behavior:
Compiles with errors, tsc also compiling node_modules.
Some lines of the output:
node_modules/typescript/lib/typescriptServices.d.ts(2523,9): error TS2300: Duplicate identifier 'interfaceName'.
node_modules/typescript/lib/typescriptServices.d.ts(2524,9): error TS2300: Duplicate identifier 'moduleName'.
node_modules/typescript/lib/typescriptServices.d.ts(2525,9): error TS2300: Duplicate identifier 'typeParameterName'.
node_modules/typescript/lib/typescriptServices.d.ts(2526,9): error TS2300: Duplicate identifier 'typeAliasName'.
node_modules/typescript/lib/typescriptServices.d.ts(2527,9): error TS2300: Duplicate identifier 'parameterName'.
node_modules/typescript/lib/typescriptServices.d.ts(2528,9): error TS2300: Duplicate identifier 'docCommentTagName'.
node_modules/typescript/lib/typescriptServices.d.ts(2529,9): error TS2300: Duplicate identifier 'jsxOpenTagName'.
node_modules/typescript/lib/typescriptServices.d.ts(2530,9): error TS2300: Duplicate identifier 'jsxCloseTagName'.
node_modules/typescript/lib/typescriptServices.d.ts(2531,9): error TS2300: Duplicate identifier 'jsxSelfClosingTagName'.
node_modules/typescript/lib/typescriptServices.d.ts(2532,9): error TS2300: Duplicate identifier 'jsxAttribute'.
node_modules/typescript/lib/typescriptServices.d.ts(2533,9): error TS2300: Duplicate identifier 'jsxText'.
node_modules/typescript/lib/typescriptServices.d.ts(2534,9): error TS2300: Duplicate identifier 'jsxAttributeStringLiteralValue'.
node_modules/typescript/lib/typescriptServices.d.ts(2556,9): error TS2451: Cannot redeclare block-scoped variable 'disableIncrementalParsing'.
>> 8586 non-emit-preventing type warnings
>> Error: tsc return code: 2
Warning: Task "ts:default" failed. Use --force to continue.
Aborted due to warnings.
It tries to compile the node_modules.
I can bypass this problem by add:
"exclude": [
"node_modules"
]
to the tsconfig.json.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.
Activity
DaSchTour commentedon Aug 8, 2016
Try including only typings/index.d.ts and not all typings separately + typings/index.d.ts which already references all of them
mhegazy commentedon Sep 21, 2016
Daniel Schuba (@DaSchTour) how are you invoking the compiler?
DaSchTour commentedon Sep 21, 2016
Mohamed Hegazy (@mhegazy) While developing I use IntelliJ by using tsc from node_modules. CI uses gulp or grunt.
RyanCavanaugh commentedon Aug 22, 2019
The default
excludesalready excludesnode_modules; seems something else is going on here.