1.0 KiB
1.0 KiB
Support legacy HTML-like comments script blocks (#8173 by @fisker, #8394 by @fisker)
Previously we parse html <script> blocks as "module"(ECMAScript Module grammar), this is why we can't parse comments starts with <!--(aka HTML-like comments), now we parse <script> blocks as "script", unless this <script>
type="module"type="text/babel"anddata-type="module", will be introduced in babel@v7.10.0
<!-- Input -->
<SCRIPT>
<!--
alert("hello" + ' world!')
//--></SCRIPT>
<!-- Prettier stable -->
SyntaxError: Unexpected token (2:1)
1 |
> 2 | <!--
| ^
3 | alert("hello" + ' world!')
4 | //-->
<!-- Prettier master -->
<script>
<!--
alert("hello" + " world!");
//-->
</script>