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

Cannot Resolve Stylename If not explicitly a String

Open
#72 3 comments 9 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
2k
Forks
159
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.