Search code examples
google-closure-compilertsctsconfigtsickle

Tsickle says "Error No inputs were found in config file" if I call it with tsconfig.json in a different directory


Calling tsickle with

tsickle --externs=target/externs.js -- -p target/src

I get this error:

Error No inputs were found in config file 'target/src/tsconfig.json'. Specified 'include' paths were '["./my/pathes/**/*.ts"]' and 'exclude' paths were '["some/other/thing"]'.

Why? Considering that tsickle is only a wrapper around tsc, if I do an equivalent tsc call, it happens without any problem. Something must go bad in the tsickle-tsc interaction, but what?


Solution

  • According to this Github issue, there is some incompatibility between tsickle and the typescript.

    The probable reason can be that neither side want to admit that it is their mistake, thus none of them wants to fix it.

    The solution is this: either the tsconfig.json given to the tsickle should have an absolute path, or the include: in this tsconfig.json should use an absolute path.

    Considering that the .json format is not a very configurable thing (for example, you simply can't give an include: [ __dirname + '/my/lib/**.ts' ] setting in it), the probably better option is to simply give an absolute path to the tsickle.

    In my case, I simply extended an arguments: ['-p', 'src/tsconfig.json'] in my Gruntfile to arguments: ['-p', __dirname + 'src/tsconfig.json']. If you use a different build tool, your actual solution my differ from it, but it is the important part.