Fixed issue with skipping over self & source generated by another instance (#12495)
This commit is contained in:
parent
fc82169b4e
commit
01ab1e3e7b
@ -837,7 +837,6 @@ You can set \`throwIfNamespace: false\` to bypass this warning.`,
|
||||
if (name === "__source" || name === "__self") {
|
||||
if (found[name]) throw sourceSelfError(path, name);
|
||||
found[name] = true;
|
||||
if (!options.development) continue;
|
||||
}
|
||||
|
||||
props.push(convertAttribute(attr));
|
||||
@ -850,15 +849,6 @@ You can set \`throwIfNamespace: false\` to bypass this warning.`,
|
||||
const objs = [];
|
||||
|
||||
for (const attr of attribs) {
|
||||
const name =
|
||||
t.isJSXAttribute(attr) &&
|
||||
t.isJSXIdentifier(attr.name) &&
|
||||
attr.name.name;
|
||||
|
||||
if (!options.development && (name === "__source" || name === "__self")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (useSpread || !t.isJSXSpreadAttribute(attr)) {
|
||||
props.push(convertAttribute(attr));
|
||||
} else {
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
module.exports = () => ({
|
||||
plugins: [["@babel/plugin-transform-react-jsx", { pragma: "___EmotionJSX" }]],
|
||||
});
|
||||
@ -0,0 +1,5 @@
|
||||
import * as React from "react";
|
||||
|
||||
export default function Foo() {
|
||||
return <div />;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"presets": [
|
||||
["@babel/preset-react", { "development": true }],
|
||||
"./emotion-css-prop-preset.js"
|
||||
],
|
||||
"os": ["linux", "darwin"]
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
var _jsxFileName = "<CWD>/packages/babel-preset-react/test/fixtures/regression/another-preset-with-custom-jsx-keep-source-self/input.mjs";
|
||||
import * as React from "react";
|
||||
export default function Foo() {
|
||||
return ___EmotionJSX("div", {
|
||||
__self: this,
|
||||
__source: {
|
||||
fileName: _jsxFileName,
|
||||
lineNumber: 4,
|
||||
columnNumber: 10
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user