Skip to content
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

SWC produces invalid output without mininification #10028

Open
AlfonzAlfonz opened this issue Feb 12, 2025 · 0 comments
Open

SWC produces invalid output without mininification #10028

AlfonzAlfonz opened this issue Feb 12, 2025 · 0 comments
Labels
Milestone

Comments

@AlfonzAlfonz
Copy link
Contributor

Describe the bug

SWC correctly transpiles unicode code point escapes when minification is true, but leaves them as is without it. This results in invalid ES5 syntax.

Input code

const x = "\u{20BB7}";

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript"
    },
    "target": "es5"
  },
  "minify": false
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.10.15&code=H4sIAAAAAAAAA0vOzysuUahQsFVQiimtNjJwcjKvVbIGAHMWJboWAAAA&config=H4sIAAAAAAAAA1WPSw7DIAwF9zkF8rrbdtE79BAWdSIifrKJVBTl7iUE0maH3xsz8jooBbNoeKq1PMsQkYX4nEsi2Sf8lARIOxTNJia49XaWvRrRCtVoOxpIyBOluiX3hoMNQajjLXPGmzH%2FC3VwkUnkCu4o%2BsnSVTc0JbjwXmrZDkk50qF%2FwA%2FqsvNjMPLqm4kXGrYvhlQioBQBAAA%3D

SWC Info output

No response

Expected behavior

Output should be the same as with minification:

var x= "\uD842\uDFB7";

Actual behavior

ES6 unicode escape code point

var x = "\u{20BB7}";

Version

1.10.15

Additional context

No response

@kdy1 kdy1 added this to the Planned milestone Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants