【问题标题】:How automatically compile jsx or tsx to js into visual studio code?如何自动将jsx或tsx编译成js成visual studio代码?
【发布时间】:2016-12-20 01:43:02
【问题描述】:

如何将 react jsx 或 tsx to js 自动编译成 Visual Studio 代码? 是否需要任务运行器?还是只是对 jsconfig.json 的配置?

我已经尝试过的:

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

我想知道是否有任何配置可以进行此转换而无需配置运行任务。 ,例如像 Full Visual Studio 这样的“保存时编译”。

【问题讨论】:

  • 请向我们展示您到目前为止所做的事情。 ;)
  • 没什么,只是学习。

标签: visual-studio-code react-jsx jsx tsx


【解决方案1】:

你可以添加

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

到 keybindings.json

并创建文件tasks.json

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

【讨论】:

    猜你喜欢
    • 2017-02-28
    • 1970-01-01
    • 2023-03-10
    • 2017-04-20
    • 2021-09-16
    • 2021-10-19
    • 2020-04-09
    • 2018-09-27
    • 1970-01-01
    相关资源
    最近更新 更多