Visual Studio 2015 社区中的 ES6/ES7 支持 [英] ES6 / ES7 support in Visual Studio 2015 Community

查看:33
本文介绍了Visual Studio 2015 社区中的 ES6/ES7 支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说 VS 2015 支持新的 js 语法,但是当我在此 IDE 中打开使用 aurelia.js 编写的项目时,intellisense 会抱怨很多很多事情,例如.

导出类 UpperValueConverter {到视图(值){返回值 &&value.toUpperCase();}}

我安装了 WebEssentials 2015.似乎仍然没有任何效果......可能一个重要的信息是我当前的 VS 安装是全新的,所以我没有搞砸任何设置.

解决方案

我在 .jsx 文件中遇到了这个问题,visual studio 2015 使用的是

如果我们能以某种方式就好了 我设法将 react-tools 转换换成了 babel stage-1 转换器,在此处查看我的回答:-)

I'm hearing that VS 2015 is supporting the new js syntax but when I open up a project written using aurelia.js in this IDE intellisense complains about many, many things eg.

export class UpperValueConverter {
  toView(value){
    return value && value.toUpperCase();
  }
}

I have the WebEssentials 2015 installed. Still nothing seems to work... Probably an important information is that my current VS installation is a fresh one, so I didn't mess up any settings.

解决方案

I was having this problem in .jsx files, visual studio 2015 was using the react-tools plugin to parse and highlight the syntax errors.

I can't find the question i got this from now, but someone said to change a line in the following file:

C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDEExtensionsMicrosoftWeb ToolsExternal
eact-serverserver.js

Change the following line:

var transformed = reactTools.transformWithDetails(code, { elementMap: true });

To:

var transformed = reactTools.transformWithDetails(code, 
    { elementMap: true, 
      es6module: "--es6module", 
      harmony: "--harmony", 
      nonStrictEs6module: "--non-strict-es6module"  });

I added the option nonStrictEs6module, and now it doesn't warn me over most things except directly assigned arrows functions:

It would be nice if we could somehow I managed to swap out the react-tools transform for a babel stage-1 transformer, check out my answer here :-)

这篇关于Visual Studio 2015 社区中的 ES6/ES7 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆