You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
swc is transpiling line breaks to \n characters. This is normally fine, but if we're going to use the raw string (either String.raw tagged template literal or the .raw in the first argument to custom tagged template literal), these are different.
Input code
console.log(String.raw`a
b
c
`);
console.log(String.raw`a\nb\nc\n`);
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
swc is transpiling line breaks to \n characters. This is normally fine, but if we're going to use the raw string (either
String.raw
tagged template literal or the.raw
in the first argument to custom tagged template literal), these are different.Input code
Gets transpiled to
Whereas babel retains the original line breaks (the code can run in modern node unchanged) - Babel REPL
Config
browserslist here is
node 14
(this is in jest, but I've reproduced the same with the swc cli)
Expected behavior
Retain the line breaks as line breaks
Running the original code would print
Running the code post transpilation would print
Version
The version of @swc/core: 1.2.55
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: