1

I was trying to add a new .js file but forgot to add an extension. I removed it and created a new one but intelliJ won't recognize it as a JavaScript File.

What I've tried:

  • Removing it and re-creating it
  • Commit it to git
  • Restarting IntelliJ
  • Rebooting the computer

The file:

myComponent.js

import React from 'react';

const MyCOmponent = () => {
  return <h1>Hello World!</h1>;
}

export default MyComponent;
Gemtastic
  • 6,253
  • 6
  • 34
  • 53

1 Answers1

8

You accidentally added your file name and extension to the list of files interpreted as a text file. To fix it you need to remove the specific file.

Navigate to IntelliJ settings either from the file menu File -> Settings or clicking the wrench in the toolbar:

enter image description here

Inside Settings you need to find the recognized file types by navigating Settings -> Editor -> File Types -> Text then selecting your file's name in the list. Remove it by clicking the - in the option list to the right of the file extensions list, like so:

enter image description here

IntelliJ should now recognize your file as a normal .js file.

Gemtastic
  • 6,253
  • 6
  • 34
  • 53