Webstorm 不識別es6 import React from ‘react’——webstorm不支持jsx語法怎么辦


2016-10-31更新

webstorm不支持es6語法怎么辦?

 

 

webstorm不支持jsx語法怎么辦?

參考:webstorm不支持jsx語法怎么辦

 

 

 

 

 


I spent ages trying to fix this. Every solution talks about 'setting options'. I don't know what that means. Finally, I figured it out. You can just include a commented out line at the top of the file /*jshint esversion: 6 */.

//如果jsx語法報錯 在頂部加入
/*jshint esversion: 6 */這段注釋
另外如果提示導入的包報錯,請使用雙引號 "react","antd"

可以參考這篇文章:http://stackoverflow.com/questions/27441803/why-does-jshint-throw-a-warning-if-i-am-using-const (需要翻牆好像。。。)

 

最后上張效果圖:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM