简体   繁体   English

Webstorm SystemJS导入解决错误

[英]Webstorm SystemJS import resolve error

SystemJS makes it possible to specify what kind of content is rendered from the imported files: SystemJS使得可以指定从导入的文件呈现什么样的内容:

  • CSS System.import('my/file.css!') CSS System.import('my/file.css!')
  • Image System.import('some/image.png!image') Image System.import('some/image.png!image')
  • JSON System.import('some/data.json!').then(function(json){}) JSON System.import('some/data.json!').then(function(json){})
  • Text System.import('some/text.txt!text').then(function(text) {}) 文本System.import('some/text.txt!text').then(function(text) {})

( Source ) 来源


Using SystemJS, importing from a file with a type appended, gives an error in Webstorm. 使用SystemJS从具有附加类型的文件导入时,Webstorm中出现错误。
So when I do this: 所以当我这样做时:

import template from './404.template.html!text';

meaning I need the html file in plain text, Webstorm shows an error saying: 这意味着我需要纯文本格式的html文件,Webstorm会显示一条错误消息:

Cannot resolve file '404.template.html!text' 无法解析文件“ 404.template.html!text”

showing red underlines throughout all of my project file structure tree. 在我的所有项目文件结构树中都显示红色下划线。

How can I get Webstorm to only resolve the part before the ! 我如何才能使Webstorm仅解决! 之前的部分! ?

不幸的是,设置为JSX Harmony在WebStorm 11中不再起作用。

After submitting an bug report on the JetBrains issue tracker, I got an answer which suggested that I should: 在通过JetBrains问题跟踪器提交错误报告后,我得到了一个答案,建议我:

Change JavaScript language version to JSX harmony in 将JavaScript语言版本更改为JSX harmony
Settings > Languages & Frameworks > JavaScript Settings > Languages & Frameworks > JavaScript

Mine was on ECMAScript 6 which I thought was the right one... 我的是ECMAScript 6 ,我认为这是正确的...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM