谷歌浏览器黄色警告Fetching scripts with an invalid type/language attributes is deprecated and will be removed in M56...的解决方案
在站点中如果使用es6语法的模块化module写法,在某些谷歌浏览器中解析执行的时候没有效果,并有黄色警告提醒:
Fetching scripts with an invalid type/language attributes is deprecated and will be removed in M56, around January 2017. See https://www.chromestatus.com/features/5760718284521472 for more details.
警告中提到了 https://www.chromestatus.com/features/5760718284521472 这个地址,这是谷歌官方的错误提示:
Deprecate all fetches for scripts with invalid type/language attributes Right now, the preload scanner will send fetches for script tags regardless of type/language, but the script will not execute when parsed. Often, sites will use these custom tags combined with XHR, resulting in double downloads. By deprecating the fetch, the preload scanner and the parser will have the same semantics, and we will not be initiating fetches for scripts we will not execute. To work around this issue and maintain the fetch, sites should use link preload.
大意就是script标签不支持当前设置的type属性(因为es6中的module模块化需要设置script标签type='module'属性)。其实这个问题也简单,说白了,就是你当前用的浏览器版本太低了,下载个最新的官方版谷歌浏览器就行了。
这里也要注意,目前一些国产浏览器(360安全浏览器、搜狗浏览器、腾讯QQ浏览器等)集成的谷歌内核版本都较低,尽量别用这些浏览器做测试。