visual-studio-code - 让 babel 观看两个文件夹

标签 visual-studio-code babeljs

目标:我有两个子文件夹(jsx 用于 jsx 文件)和(dash7 用于 ECMA-2017 脚本)我不想合并这些文件夹。我想设置一个可以监视这两个文件夹的 VSCODE 任务。

问题:现在,我有两个独立的任务。一个“jsx watch”另一个“es7 watch”。我一次只能用 VS Code 运行一个。

问题:有没有一种方法可以编写一个同时执行这两项任务的任务,或者有没有一种方法可以让 babel 监视两个单独的文件夹。或者其他解决方案?

{
    "version": "0.1.0",
    "command": "${workspaceRoot}/node_modules/.bin/babel.cmd",
    // "isShellCommand": true,
    "tasks": [
        {
            "args": ["jsx", "--out-dir", "jsxo", "-w", "--source-maps inline"],
            "taskName": "jsx watch",
            "suppressTaskName": true,
            "isBuildCommand": true, // make this the F1 > Task: Run Build Task gesture
            "isBackground": true // tell VS Code not wait for this task to finish
        },
        {
            "args": ["dash7", "--out-dir", "dash", "-w", "--source-maps inline"],
            "taskName": "es7 watch",
            "suppressTaskName": true,
            "isBuildCommand": true, // make this the F1 > Task: Run Build Task gesture
            "isBackground": true // tell VS Code not wait for this task to finish
        }
    ]
}

babel 预设

  "babel": {
    "sourceMaps": "inline",
    "presets": [
      "react",
      "node7"
    ]

最佳答案

VSCODE 人员刚刚使用新的终端运行程序更新了 Visual Code:

https://github.com/Microsoft/vscode/issues/981

如果您将版本更改为 2.0.0,那么您可以一次运行多个任务!

{
    "version": "2.0.0",
    "command": "${workspaceRoot}/node_modules/.bin/babel.cmd",
    // "isShellCommand": true,
    "tasks": [
        {
            "args": ["jsx", "--out-dir", "jsxo", "-w", "--source-maps inline"],
            "taskName": "jsx watch",
            "suppressTaskName": true,
            "isBuildCommand": true, // make this the F1 > Task: Run Build Task gesture
            "isBackground": true // tell VS Code not wait for this task to finish
        },
        {
            "args": ["dash7", "--out-dir", "dash", "-w", "--source-maps inline"],
            "taskName": "es7 watch",
            "suppressTaskName": true,
            "isBuildCommand": true, // make this the F1 > Task: Run Build Task gesture
            "isBackground": true // tell VS Code not wait for this task to finish
        }
    ]
}

关于visual-studio-code - 让 babel 观看两个文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43809502/

相关文章:

angularjs - 无法连接到目标 : connect ECONNREFUSED 127. 0.0.1:9222

flutter - 如何解决 "Execution failed for task ' :app:compileFlutterBuildDebug'."

visual-studio-code - 我可以在 VS Code difftool 模式下突出显示字符吗?

reactjs - 使对象传播以使用 webpack.config 和 babelrc 文件

javascript - babel watch 语法错误 : Unexpected token

javascript - 如何提高reactjs在移动端的初始渲染性能?

javascript - 导入 react-native-fetch-blob 时出现意外 token

json - Visual Studio Code侧边栏选择颜色

visual-studio-code - 防止在单击选项卡时在源树中导航 - Visual Studio Code

node.js - Azure Node.js Web 应用程序 (ES2015/babel) 的自定义启动命令?