导入无法在PhpStorm/Webstorm中使用JavaScript

问题描述:

我正在尝试运行一段在本教程中编写的JavaScript代码,如下所示:

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 }
})

但是,PhpStorm出现以下错误:

However, PhpStorm is giving the following error:

当前的JavaScript版本不支持导入声明

Import declarations are not supported by current JavaScript version

如何在PhpStorm中获得更新的(?)JavaScript版本?这真的是问题吗?

How I can get a newer(?) JavaScript version in PhpStorm? Is that really the problem here?

根据您的喜好,将javascript版本更改为ECMAScript 6.

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