Thursday, August 13, 2015

Enable EcmaScript 6 support in Visual Studio Code

Recently Microsoft announced the support for EcmaScript 6 in Visual Studio code.
However when you try to use ES6 features, you get errors:
image
Hovering over the error, gives some insight on how to fix this:
image
We have to create or edit our jsconfig.json file and change the target to ES6.
Add a new file and call it jsconfig.json. Add the following configuration settings:
image
If you now go back to the code file, the errors are gone:
image
Happy coding!

1 comment:

mcafazzo said...

In "Add a new file and call it jsonconfig.json", the filename is referenced as "jsonconfig.json" - the screenshot is correct, however (jsconfig.json). Otherwise, great post for those of us who did not follow the Visual Studio Code instructions.