获取应用程序/ dart脚本unsuopported [英] Fetching application/dart script unsuopported

查看:180
本文介绍了获取应用程序/ dart脚本unsuopported的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的dart应用程序的index.html文件设置:

 <!DOCTYPE html> 
< html>
< head>
< title> basic_app< / title>
< script defer src =main.darttype =application / dart>< / script>
< script defer src =packages / browser / dart.js>< / script>
< / head>
< body>
< / body>
< / html>

Chrome已开始向我发出警告:



获取无效类型/语言属性的脚本已被弃用,并会在2017年1月左右在M56中删除。请参阅 https://www.chromestatus.com/features/5760718284521472 了解更多详情。



我必须改变什么才能摆脱这个警告?
我相信这是由这行引起的:

 < script defer src =main.darttype = application / dart>< / script> 


解决方案

Chrome不知道Dart,加载Dart脚本标记。 pub build 不会删除Dart脚本标记。有 dart_to_js_script_rewriter 转换器删除了Dart脚本标记,因此只有dart2js-transpiled JS代码


$ b

添加包为 dev _ $ b

  dev_dependencies:
dart_to_js_script_rewriter:^ 1.0.1

和变压器配置结束

  
- dart_to_js_script_rewriter


I have my index.html file setup for a dart application like this:

<!DOCTYPE html>
<html>
  <head>
    <title>basic_app</title>
    <script defer src="main.dart" type="application/dart"></script>
    <script defer src="packages/browser/dart.js"></script>
  </head>
  <body>
  </body>
</html>

Chrome has started throwing a warning at me that says:

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.

What do I have to change to get rid of this warning? I believe it is caused by this line:

<script defer src="main.dart" type="application/dart"></script>

解决方案

Chrome doesn't know about Dart, only Dartium can load Dart script tags. pub build doesn't remove the Dart script tag. There is the dart_to_js_script_rewriter transformer that removes that Dart script tag so that only the dart2js-transpiled JS code is loaded in production:

Add the package as dev_dependency`

dev_dependencies:
  dart_to_js_script_rewriter: ^1.0.1

and the transformer configuration at the end of the transformers configuratino:

transformers:
- dart_to_js_script_rewriter

这篇关于获取应用程序/ dart脚本unsuopported的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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