gajus / gajus/babel-plugin-react-css-modules

Cannot Resolve Stylename If not explicitly a String

Offen
#72 3 Kommentare 9 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
JavaScript
Sterne
2k
Forks
159
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Take the following code snippet:

```
render() {
const appliedStyles = ['one', 'two'];
appliedStyles.push(this.props.a ? 'style-a' : 'style-b');

return (


Hello

);
}
```

What you'll see is that we'll end up getting something like `Unhandled rejection Error: Could not resolve the styleName 'style-a'.`

However, if we change the code ever so slightly to
```


```
then it seems to work.

Is this a Babel constraint or a fixable bug? The pattern works with your [non-babel version](https://github.com/gajus/react-css-modules).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.