dead-code-elimination erroneously tries to inline expressions into JSXIdentifiers.
- Dominant language
- JavaScript
- Stars
- 4.4k
- Forks
- 217
- PR merge metrics
- No merged PRs in 30d
Description
Reproduction on RunKit: https://runkit.com/tolmasky/dead-code-inlines-jsxidentifiers
```javascript
function Input(element)
{
var ElementType = element || "input";
return ;
}
```
This will try to put `(element || "input")` into the actual JSX element, (something like `<(element||"input") ref = "input/>`), which is not allowed, and will thus throw this error:
TypeError: unknown: Property name of JSXOpeningElement expected node to be of a type ["JSXIdentifier","JSXMemberExpression"] but instead got "LogicalExpression"
It is important that I run this before my actual React transforms, since there are in-between transforms that rely on the right code having been removed, so I can not use as a temporary workaround switching the order of the transformations.
Contributor guide
Assessment
This issue has not been assessed yet.