Search code examples
visual-studio-codereactjsjsxtsx

How automatically compile jsx or tsx to js into visual studio code?


How automatically compile react jsx or tsx to js into visual studio code? Is a task runner needed? or just a configuration into jsconfig.json?

What I already tried:

I already tried to create a jsconfig.json with jsx parameter without success. I configured a TS compiler, however it compiles only TS to JS, not JSX to JS.

I'm wondering if there any configuration that makes this conversion without need to configura a run task. , for instance "compile on save" like the Full Visual Studio.


Solution

  • You may add

    [
        {
            "key": "ctrl+s",          
            "command": "workbench.action.tasks.build" 
        }
    ]
    

    to keybindings.json

    and create file tasks.json

    {
        "version": "0.1.0",
        "command": "webpack",
        "isShellCommand": true,
        "args": [],
        "showOutput": "always"
    }