如何自动将jsx或tsx编译成js成visual studio代码?

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

如何自动将react jsx或tsx转js编译成visual studio代码? 需要任务 运行ner 吗?或者只是配置成 jsconfig.json?

我已经尝试过的:

我已经尝试使用 jsx 参数创建 jsconfig.json 但没有成功。 我配置了一个TS编译器,但是它只能编译TS到JS,不能编译JSX到JS。

我想知道是否有任何配置可以进行此转换而无需配置 运行 任务。 ,例如 "compile on save" 就像完整的 Visual Studio.

您可以添加

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

到keybindings.json

并创建文件 tasks.json

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