I'm trying to run a piece of JavaScript code written in a tutorial that looks like this:
main.js
import Vue from 'Vue'; import Alert from './components/Alert.vue'; new Vue({ el: 'body', components: { Alert } })
However, PhpStorm is giving the following error:
Import declarations are not supported by current JavaScript version
How I can get a newer(?) JavaScript version in PhpStorm? Is that really the problem here?
With PhpStorm, you can develop modern web, mobile, and desktop applications with JavaScript and Node. js. PhpStorm also supports React, Angular, Vue. js, and other frameworks and provides tight integration with various tools for web development.
To run a script, open it in the editor or select it in the Project tool window, and then select Run <script file name> from the context menu. WebStorm creates a temporary run/debug configuration of the type Node. js. To run a test, click the gutter icon next to it or press Ctrl+Shift+F10 .
NOTE: PhpStorm includes all the functionality of WebStorm (HTML/CSS Editor, JavaScript Editor) and adds full-fledged support for PHP and Databases/SQL. Their forum also has quite few answers for such question.
Choose the JavaScript language versionIn the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Languages & Frameworks | JavaScript. The JavaScript page opens. From the list, choose one of the supported JavaScript language versions: ECMAScript 5.1.
In your preferences, change the version of javascript to ECMAScript 6.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With