How to disable auto-recognition of .js files as TypeScript compilation output in IntelliJ IDEA
I'm using the latest version of IntelliJ IDEA and working on a project that uses both JavaScript and TypeScript. I'm facing an issue where IntelliJ automatically recognizes .js files as compiled output of .ts files when they have the same name.
What is the current method to disable the automatic recognition of .js files as TypeScript compilation output in the latest version of IntelliJ IDEA?
Example: Let's say I have the following files in my project:
src/
── example.ts
└── example.js
When I open example.js, I see a message at the top of the file saying "Excluded from compilation". This indicates that IntelliJ IDEA is treating this .js file as a compilation output of the .ts file, which is not what I want.
What I want to achieve: I want IntelliJ IDEA to treat both .ts and .js files as separate, editable source files, without automatically assuming the .js file is a compiled output.
Is there a way to do this?
Please sign in to leave a comment.
The
.jsfiles with names matching.tsfiles are treated as generated and auto-excluded from indexing for better performance and navigation by adding them toexactExcludedFileslist inworkspace.xmlIf you like them to be included, please try adding
<option name="excludeGeneratedFiles" value="false" />to your project.idea/workspace.xml:.idea/workspace.xml<component name="TypeScriptGeneratedFilesManager">section with the lines below:Hope it helps
Elena Pogorelova
Thank you very much. As you suggested, changing the settings resolved the issue!
However, in the IntelliJ directory UI, the UI that folds under the ts folder as a subfolder is still functioning. Is there a way to modify this setting as well? I'd like to treat them as completely separate files.
You can try modifying the file nesting rules accordingly.
Elena Pogorelova Thank you very much, it's been resolved!