Monday, May 15, 2017

getting babel to watch two folders

Leave a Comment

Goal: I have two sub-folders (jsx for jsx files) and (dash7 for ECMA-2017 scripts) I don't want to combine these folders. I want to setup a VSCODE tasks that can watch both folders.

Issue: Right now, I have two separate tasks. One "jsx watch" the other "es7 watch). I can only run one at a time with VS Code.

Question: is there a way to write a task that does both, or is there a way to get babel to watch two separate folders. Or another solution?

{     "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 presets

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

1 Answers

Answers 1

The VSCODE folks just updated Visual Code with a new terminal runner:

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

If you change the version to 2.0.0 then you can run multiple tasks at once!

{     "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         }     ] } 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment