Go to definition for .jsx doesn't work

I am working with es6 syntax in Visual Studio Code and when I import a normal file then I can press F12 (go to definition) and it works fine. The problem is that with components (import from .jsx files) it doesn't work at all (nothing happens when you click go to definition

). Does anyone know how to fix this?

PS I have jsconfig.json

that allows you to correctly navigate to the definition for regular .js files:

{
    "compilerOptions": {
        "target": "ES6"
    },
    "exclude": [
        "node_modules"
    ]
}

      

+3


source to share


1 answer


While you can find a solution from the github issues mentioned in one of the comments, I wanted to make it easier for SO users. Quoting from the Github issues page:

An easy workaround is to add a compilerOption "jsx": "save" (or "jsx": "react" or "jsx": "react-native")



jsconfig.json:

{
    "compilerOptions": {
        "jsx": "react"
    }
}

      

+2


source







All Articles