-
-
Notifications
You must be signed in to change notification settings - Fork 721
Closed
Copy link
Labels
A-transformerArea - Transformer / TranspilerArea - Transformer / TranspilerP-highPriority - HighPriority - High
Description
For the following input, Oxc does not merge the injected props (_self, _source) to the normal props, which is incorrect:
import * as React from "react";
export function Foo(props) {
return (
<div {...props}>
<p>a</p>
</div>
);
}The actual output is:
import * as React from "react";
var _jsxFileName = "foo.jsx";
export function Foo(props) {
return /* @__PURE__ */ React.createElement("div", props, {
__self: this,
__source: {
fileName: _jsxFileName,
lineNumber: 6,
columnNumber: 5
}
}, /* @__PURE__ */ React.createElement("p", {
__self: this,
__source: {
fileName: _jsxFileName,
lineNumber: 7,
columnNumber: 7
}
}, "a"));
}The expected output is:
import * as React from "react";
var _jsxFileName = "foo.jsx";
export function Foo(props) {
return /* @__PURE__ */ React.createElement("div", {
...props,
__self: this,
__source: {
fileName: _jsxFileName,
lineNumber: 6,
columnNumber: 5
}
}, /* @__PURE__ */ React.createElement("p", {
__self: this,
__source: {
fileName: _jsxFileName,
lineNumber: 7,
columnNumber: 7
}
}, "a"));
}reproduction using transform function exposed from rolldown
swc playground
Metadata
Metadata
Assignees
Labels
A-transformerArea - Transformer / TranspilerArea - Transformer / TranspilerP-highPriority - HighPriority - High