2

When I open my project a .js file, there comes this warning:

File watcher 'Babel' is available for this file. Description: 'Transpiles ECMAScript 6 code to ECMAScript 5'

there are two buttons: Add watcher and Dismiss.

if I click the Add watcher:

enter image description here


I have two questions:

1) What's the meaning of File watcher 'Babel' is available for this file. Description: 'Transpiles ECMAScript 6 code to ECMAScript 5'?

2)How to configure the watcher file?

user7693832
  • 6,119
  • 19
  • 63
  • 114
  • please see https://blog.jetbrains.com/webstorm/2015/05/ecmascript-6-in-webstorm-transpiling/ – lena Mar 06 '18 at 12:37
  • note that you don't need creating a watcher if you are not using ECMAScript 6/7 syntax in your code, or if you are using webpack, etc. to build and bundle it – lena Mar 06 '18 at 12:38

1 Answers1

1

Here's a link to Babel: https://babeljs.io/

What this does is allow you to use advanced JavaScript capabilities that some web browsers might not yet support. You can write your code as if those capabilities are there, and the transpiler will translate your advanced JavaScript into older-style compatible JavaScript.

What the "watcher" does is watch for changes in your code so that the transpiler can immediately run when there are changes in order to keep generating up-to-date translations of your code.

You'll have to read the documentation for Babel to fully understand how to configure it, but, in short, you're telling Babel where to find your files, where to place transpiled output, setting various options for how often code changes are checked, and other transpiler options.

kshetline
  • 12,547
  • 4
  • 37
  • 73