-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary escaping of tagged template literal output #7196
Comments
Yeah, at a glance I'd expect it to not escape line breaks etc, like you say. |
it is indeed a regression, it worked on v11.1.0 to v11.1.1 and then got broken again in v11.1.2 as you can see in the playground. The regression was likely introduced by #6810 that got shipped with v11.1.2-rc.1. Unfortunately we didn't test for this case. |
@cknitt what's is actually weird is that in JS
And if you try to access the character, it'll be the same too, so I don't even know how it can tell the difference.
|
after some investigation, the current output is actually correct in JS, it just breaks compatibility with some tools like gatsby that directly parse the JS file (cf comment). My recommendation would be to not backport any fix to v11 because the current behavior is correct, but for v12 we could actually make backquoted string literals be output as backquoted string literals in JS too, and that would solve this kind of incompatibility issues. What do you think @cknitt ? |
@cknitt Can you share the full trace of the |
I was recently starting to modernize an old Gatsby project and moving more stuff to ReScript there. Gatsby uses graphql queries to fetch the content to render.
The following ReScript code
produced this output:
which Gatsby didn't like at all:
I think we should emit the string for the template literal exactly as defined in the ReScript code, i.e., without escaping.
The text was updated successfully, but these errors were encountered: