You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin gives an invalid transform result when using css={{...}} (i.e., css prop with object notation), and a local variable name matches a css keyword that is present in the object notation.
I use vite v5.0.12, @babel/core v7.24.6, and babel-plugin-styled-components v2.1.4.
Minimal example
This minimal example shows the bug:
import{css}from"styled-components";constTestComponent1=()=>{letposition=1;// assume the variable is used for something else ...return<divcss={{position: "absolute"}}/>;};
Here, the <div> is transformed to this invalid JavaScript:
This plugin gives an invalid transform result when using
css={{...}}
(i.e., css prop with object notation), and a local variable name matches a css keyword that is present in the object notation.I use
vite
v5.0.12,@babel/core
v7.24.6, andbabel-plugin-styled-components
v2.1.4.Minimal example
This minimal example shows the bug:
Here, the
<div>
is transformed to this invalid JavaScript:Correct behavior
These replacements must be restricted to the right side of
:
as in this example which works correctly:In this case, the div is correctly transformed to valid JavaScript:
Full error message
The text was updated successfully, but these errors were encountered: