Files
test-repo/changelog_unreleased/html/pr-8173.md
T
fisker Cheung 3606c2e192 Support babel data-type="module" (#8394)
* Support babel `data-type="module"`

* Update changelog
2020-05-25 12:48:31 +03:00

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>

  1. type="module"
  2. type="text/babel" and data-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>