Typescript: tsconfig is not excluding node_modules

Created on 13 Feb 2017  路  7Comments  路  Source: microsoft/TypeScript


no matter what i do it won't ignore node_modules... form the documentation this is supposed to even be by default.

TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)
2.1.6

Code
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"sourceMap": true,
"removeComments": false,
"noImplicitAny": false,
"declaration": true,
"outDir": "../dist"

    },
    "files": [
      "../src/multiple-date-picker.module.ts"
     ]
   }
// A *self-contained* demonstration of the problem follows...

Expected behavior:
it should work
Actual behavior:
it is not working

Question

Most helpful comment

@xtianus79 Did you figure this out?
The article isn't much of a help quite frankly. Says what I tried already which is add the node_modules to the exclude also tried the files portion. Nothing.

All 7 comments

Please see https://github.com/Microsoft/TypeScript/wiki/FAQ#why-is-a-file-in-the-exclude-list-still-picked-up-by-the-compiler for more information.

@xtianus79 Did you figure this out?
The article isn't much of a help quite frankly. Says what I tried already which is add the node_modules to the exclude also tried the files portion. Nothing.

I do not know if you are still having this issue - I got around it by the following:

"exclude": [
"./node_modules/*"
]

Same issue here

I found out the problem thanks to --traceResolution :
i had installed @types/moment, then i read the readme (it says you do not need this package, types are already included in moment) so i removed that package from packages.json.
Well typescript has many heuristics taking place to look for type informations so, i had to manually delete tye @types/moment folder to avoid them to kick in.

This is very anoying, the amount of automation behind typescript configuration makes everything simple very hard ! and it's the manifestation of how messy the ui dev is 馃槃, with layers of things on top of each other.

@valeriob : What package had you installed that was not necessary and which readme did it mention that in?

types/moment in my case, because types are already bundled in moment package.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlaberge picture dlaberge  路  3Comments

zhuravlikjb picture zhuravlikjb  路  3Comments

Antony-Jones picture Antony-Jones  路  3Comments

DanielRosenwasser picture DanielRosenwasser  路  3Comments

seanzer picture seanzer  路  3Comments