首先,js文件报错如下图:

Idea的js文件报错:Import declarations are not supported by current JavaScript version_Languages

以下为解决方法:点击File里的Settings

Idea的js文件报错:Import declarations are not supported by current JavaScript version_Languages_02

找到Languages&Frameworks下的JavaScript,把版本从默认的5.1改为6就好了

Idea的js文件报错:Import declarations are not supported by current JavaScript version_解决方法_03

最后,apply、OK。报错就不会出现了

Idea的js文件报错:Import declarations are not supported by current JavaScript version_解决方法_04