The definitions are identical in the `tsconfig.json` files located in the Application projects. When I load the workspace in IDEA, I'm only able to have Typescript module aliases work in one of the Application projects. I have an Angular workspace with 4 projects, 2 Application projects and 2 Library projects (see tree below). None of the solutions presented seem to work but I do believe I'm representative of some of the other Angular posts about this. I have an Angular 9 project that I started around Angular 7 and I believe I have had this problem persistently through all the upgrades and I have found no solution. command would take to finish - and maybe that's what TS service is running behind the scenes anyway. It may take as much as the standalone npx tsc -noEmit -p. So be aware that after tweaking your tsconfig.*.json file - the file inspection updates in Webstorm take effect only after some time and NOT immediately. If I was to update file, for example changing compilerOptions.skipLibCheck = false, Webstorm would pick up the change after a long-ish delay - as long tsc would take to do all the type checks in your project. I am running Webstorm on Windows 10 with WSL - this is what my WS Typescript configuration looks like: In this file I also have extra "include" paths for test files - which are not in the main tsconfig.json as I don't want *.test.js files to get compiled into main bundle etc. eslintrc.js - and this file extends the main tsconfig.json file: : this file is loaded by ESLint with TS integration via.tsconfig.json: main TS config for the project.So for example, my tsconfig.*.json files setup: I had a similar issue where Webstorm TS checker would not pick up on config changes.Īnd the reason is I was not aware that it takes at least 30-40 seconds after config change for the Typescript service file inspections to update and take effect! My project is not small, so that definitely adds to the delay and TS checks take at least 30-40 seconds in my project. Some tips for those who are struggling with TypeScript language Service in Webstorm and multiple tsconfig files extending one another - and WS+TS inspections seemingly ignoring your configuration changes in tsconfig.*.json. I opened my project in VS Code and the problem does not occur there, so I don't think it's fair to say that this is expected behaviour and is not a bug in IntelliJ/WebStorm. > It's not always obvious, but the order in which you open the files can matter.Īnyone who opens a file expects path resolution to happen based on that file's nearest tsconfig, not based on the tsconfig nearest to the first file that you opened. I luckily just finally stumbled upon this thread and read this comment, closed down all of my open files and opened the single file that had the import error and then it went away: I've been searching for the answer to this and I've been reading and re-reading the official TypeScript documentation about module resolution and config files, and running tsc with -showConfig and -traceResolution and nothing stood out. I even created a new project with two simple, brand new Angular applications in it and saw exactly the same problem! I was convinced that I messed up the config when I separated the applications, and I've been trying every possible tweak to the main tsconfig.json and the two individual applications' files, I've been invalidating the cache and restarting the IDE, I tried it in just WebStorm rather than IntelliJ (even though they're basically the same thing). I recently split an Angular application into two separate applications within the same project and started seeing these errors about paths defined in tsconfig.json not being found, even though the project compiles and serves just fine. This has been driving me crazy for three whole days now.
0 Comments
Leave a Reply. |