70

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?

1 Answer 1

168

In your preferences, change the version of javascript to ECMAScript 6.

Sign up to request clarification or add additional context in comments.

11 Comments

Thank you for your answer. PhpStorm is no longer showing an error; however, the Chrome console is displaying this: Uncaught SyntaxError: Unexpected token import - main.js:1 Do you know what is going on here?
Actually I believe it is an unrelated error. Thanks again!
Now it is asking me whether I want to use Babel to convert from 6 to 5.1.
ok... So tell it what you want to do @nueverest yes or no ;-)
for people needing a step by step File > Settings > Languages & frameworks and the rest is same
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.