The clue is:
- ES "reacts" when it meets inside tagged template literals:
- expression semantics
${...}
, - the same string used as template start/end tags, a backtick (`) in the current case
- expression semantics
- for the time being, to comment out code chunks inside templates, the following workarounds are available:
${''/* ... */}
-
${''&&` ... `}
(still backtick (`) gives error)
- Any solution must be JavaScript backwards compatible
- ES might officially adopt semantics like:
-
${* ... *}
, or ${''/* ... */}
-
Thanks to all for your time!
Notes:
- "
...
" stands for content. - Read Defining dynamic comments on the fly