8000 Regression in handling · · Issue #10651 · swc-project/swc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Regression in handling · #10651
Closed
@ibacher

Description

@ibacher

Describe the bug

Say I have a React component like this:

const a = () => {
    return (
        <>&middot;</>
    )
}

In SWC up to 1.12.1, this produces:

var a = function() {
    return React.createElement(React.Fragment, null, "\xb7");
};

From 1.12.2 on, this same code produces:

var a = function() {
    return React.createElement(React.Fragment, null, "&middot;");
};

Input code

const a = () => {
    return (
        <>&middot;</>
    )
}

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": true
    },
    "target": "es5",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": {
        "toplevel": false,
        "keep_classnames": false,
        "keep_fnames": false,
        "keep_private_props": false,
        "ie8": false,
        "safari10": false
      }
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true
}

Link to the code that reproduces this issue

https://play.swc.rs/?version=1.12.1&code=H4sIAAAAAAAAA0vOzysuUUhUsFXQ0FSwtVOo5lIAgqLUktKiPAUNMAcEbOzUcjNTUvJLrG307cCimly1APVuwO48AAAA&config=H4sIAAAAAAAAA32QTQ7CIBCF9z1FM2sXutAY7%2BAZzASHhgqFMLSxaXp36Q%2B1auMGmPe%2BmQmvy%2FIcShZwybv4jIVDz%2BSXOircVgGfUQESBll45QLsklvyYAVf06j0kwEBfUFhbOLjTIO2lilqEjXTrBlVKdmu9wlrnCfmT3BAsSo0rdBhj3WaGtLfcLQeRO4mNDJXaOhnXCLkX9d51WCgeFu3BSk6b6iMEr067JM1O32WzjEmMPZerz4EoXU0RXaCN5QCWpaA4mvqHIPvXzdUBA3HAQAA

SWC Info output

No response

Expected behavior

At least without a major version change, this code should continue to produce in 1.12.x:

var a = function() {
    return React.createElement(React.Fragment, null, "\xb7");
};

Actual behavior

No response

Version

1.12.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0