[FIX] Babel 8+ 更新: t.jSXIdentifier 不是函数
diff --git a/node_modules/twin.macro/macro.js b/node_modules/twin.macro/macro.js index 6eff7ca..fcd4e3d 100644 --- a/node_modules/twin.macro/macro.js +++ b/node_modules/twin.macro/macro.js @@ -2337,13 +2337,13 @@ function handleGlobalStylesJsx(params) { if (coreContext.packageUsed.isStyledComponents) { const declaration = getGlobalDeclarationTte(declarationData); program.unshiftContainer('body', declaration);
- path.replaceWith(t.jSXIdentifier(globalUid.name));
- path.replaceWith(t.jsxIdentifier(globalUid.name));
}
if (coreContext.packageUsed.isEmotion) { const declaration = getGlobalDeclarationProperty(declarationData); program.unshiftContainer('body', declaration);
- path.replaceWith(t.jSXIdentifier(globalUid.name)); // Check if the css import has already been imported
path.replaceWith(t.jsxIdentifier(globalUid.name)); // Check if the css import has already been imported // https://GitHub.com/ben-rogerson/twin.macro/issues/313
state.isImportingCss = !state.existingCssIdentifier; @@ -2352,7 +2352,7 @@ function handleGlobalStylesJsx(params) { if (coreContext.packageUsed.isGoober || coreContext.packageUsed.isSolid) { const declaration = getGlobalDeclarationTte(declarationData); program.unshiftContainer('body', declaration);
- path.replaceWith(t.jSXIdentifier(globalUid.name));
- path.replaceWith(t.jsxIdentifier(globalUid.name));
}
coreContext.assert(Boolean(!coreContext.packageUsed.isStitches), ({ @@ -2787,7 +2787,7 @@ function addDataPropToExistingPath({ const classes = formatProp(rawClasses); // Add a new attribute
path.pushContainer( // @ts-expect-error Key is never
- 'attributes', t.jSXAttribute(t.jSXIdentifier(propName), …
内容来源: ben-rogerson/twin.macro