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

Cannot Resolve Stylename If not explicitly a String

Aperta
#72 3 commenti 9 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
JavaScript
Stelle
2k
Fork
159
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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).

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.