简体   繁体   中英

How to make NetBeans understand the “import” and “export” statements of JavaScript

Currently, if I have eg import {localeModule, test} from '../qunit'; in a JS file, NetBeans (8.0.2) marks it as an error: "Expected an operand but found import".

Does the latest NetBeans version really don't have support for that statement (doesn't sound credible for such a popular IDE, supposedly one of the best in JavaScript support), or is there some switch I have to change in the settings?

Installing NodeJS plugin didn't help.

Ah ha! The problem is what version of Javascript you have selected. JS6 supports 'import x from y;' syntax.

So for example if you are using the newest generator-angular-fullstack (which tries to show the newest, best practices) and get the import errors just:

In Webstorm: File -> Settings -> Languages & Frameworks -> Javascript -> Javascript language version, select JS6 vs JS5.x

Problem: I haven't found out how to set the JavaScript compliance version (like Eclipse has for Java) for even NetBeans 8.1 RC2 (yet).

It seems there is no support yet as of Netbeans 8.0.2

ES6 syntax support

And found this post

link to the post

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM