Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebStorm "Warning:File was not compiled because there is no a reference from tsconfig.json"

I am using WebStorm 2016.1.3 for an Angular 2 project with typescript. When I enable the ts compiler in WebStorm and modify a ts file (which should then be compiled) I get the following warning: Warning:File was not compiled because there is no a reference from tsconfig.json and the file is not compiled.

My project file/folder structure is close to the style guide recommended by Angular 2:

All my ts files are in a script folder. The root app is in that folder and every component has its own subfolder which contains one ts and one html file. Shared services etc are in a Shared subfolder.

My tsconfig looks like this and is in the project root folder (the parent folder of the script folder):

{
  "compilerOptions": {
    "outDir": "wwwroot/app",
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "inlineSourceMap": true,
    "inlineSources": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

Except for the ts files directly in script all other in WebStorm opened and modified ts files result in the warning above and do not compile. In the typescript console in WebStorm the compiler says it was compiling the modified file (i.e. change detection seems to be working) but it does not emit a transpiled file. However, when WebStorm starts ALL ts files in all subfolders are correctly compiled. Also, if I use tsc manually or via gulp I get no issues and everything compiles as it should, which tells me that my tsconfig is OK. I tried specifying my own scope in WebStorm's typescript compiler options. Made no difference. The Track changes option is on. I tried it with and without the Resolve objects using tsconfig.json option on. Made no difference.

I can't figure this thing out. Has anybody else encountered - and hopefully fixed - this issue?

like image 693
hholtij Avatar asked Jul 02 '16 14:07

hholtij


1 Answers

In case others run into this issue:

I think I have found what causes the issue. Some of my files had somewhat unusual spellings (in the typescript world). For example one of my services was spelled "ApiService.ts". After I changed this to "apiService.ts" the issue disappeared. Another was spelled "hhPager.component.ts". WebStorm didn't like that either. I now changed it to "pager.component.ts" and WebStorm relaxed and behaved.

I have brought it to JetBrain's attention and this is currently (July 8, 2016) a bug in their issue tracker (https://youtrack.jetbrains.com/issue/WEB-22290).

like image 111
hholtij Avatar answered Oct 22 '22 03:10

hholtij