目标:我有两个子文件夹(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/