Import not working with JavaScript in PhpStorm/Web

2019-02-02 22:29发布

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条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-02-02 22:43

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

查看更多
登录 后发表回答