Retrieving scripts with invalid type / language attributes is deprecated and will be deleted

I am starting to learn response.js using JSX. To use it, I connect the Babel library (no matter what the version is) and write the JSX code in the JS file:

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

type = "text / babel" - required.

But Chrome has a warning: "Retrieving scripts with invalid type / language attributes is outdated and will be deleted in M56 around January 2017. For more details see https://www.chromestatus.com/features/5760718284521472 ."

But everything is fine when I write JSX code in the DOM. Actually the problem disappears without "src = ..." I want to write code in a JS file. What should I do to avoid obsolescence? Thank.

+4
source share
4 answers

If you cannot move to the server, just put the code on the same page.

So instead

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

to try

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

+1
source

The difference is that if you just do

<script type="text/babel">
// code here
</script>

you are not extracting the script from anywhere. But in your first example you are.

If you are extracting the code from the server, you must transfer it to the server, and then extract the result, not extract it, and then transmit it to the client.

0
source

,

<script data-src="javascript.js" type="text/javascipt" ></script>

<script src="javascript.js" type="text/javascipt" ></script>
0

babel-standalone, , , , " Babel" . Babel-standalone :

Babel-standalone, . Babel-standalone Chrome 56. .

https://github.com/babel/babel-standalone/issues/72

If you are not using babel-standalone, then maybe try. This allows you to have ES6, React, etc., without requiring a build step, so this is a great way to get started and experiment. It really is not suitable for production applications.

0
source

Source: https://habr.com/ru/post/1664088/


All Articles