1

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>

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.