使用无效类型/语言属性获取脚本已被弃用,将被删除 [英] Fetching scripts with an invalid type/language attributes is deprecated and will be removed

查看:358
本文介绍了使用无效类型/语言属性获取脚本已被弃用,将被删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用JSX学习react.js。要使用它,我连接一个babel库(不管是什么版本),并在JS文件中编写一个JSX代码:

  < script src =js / app.jstype =text / babel>< / script> 

type =text / babel - 必须。



但Chrome中有一个警告:
取消无效类型/语言属性的脚本已被弃用,将于2017年1月左右在M56中删除。请参阅 https://www.chromestatus.com/features/5760718284521472 了解更多详情。



但是,当我在DOM中编写JSX代码时,一切都可以。实际上,没有一个src = ...的问题消失
我想在JS文件中编写代码。我该怎么办才能避免贬低?谢谢你。

解决方案

如果你不能在服务器上漂浮,那么只需将代码放在同一页上。 >

所以而不是



< script type =text / babelsrc =。 /app.js\"></script>



尝试



script type =text / babel>
//来自./app.js的代码到这里
< / script>


I start to learn react.js using JSX. To use it I connect a babel library (not matter what is a version) and write a JSX code in a JS file:

<script src="js/app.js" type="text/babel"></script>

type="text/babel" - necessarily.

But there is a warning in Chrome: "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."

But everything is OK, when I write a JSX code in DOM. Actually, the problem goes away without a "src=..." I want to write the code in JS file. What should I do for avoid a deprecation? Thank you.

解决方案

If you can't transpile on the server then just put the code on the same page.

So instead of

<script type="text/babel" src="./app.js"></script>

try

<script type="text/babel"> //code from ./app.js goes here </script>

这篇关于使用无效类型/语言属性获取脚本已被弃用,将被删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆