gajus / babel-plugin-react-css-modules

Transforms styleName to className using compile time CSS module resolution.
Other
2.05k stars 162 forks source link

unreasonable error #271

Closed Media-Evil closed 4 years ago

Media-Evil commented 4 years ago
//import
import style from './style.scss'
import typography from './../../styles/typography.scss'

//usage
<div styleName={`${style.content} ${typography.textblock}`}>

Error: http://prntscr.com/p59rqa

I used named import, so the error has no reason to be thrown. The strange thing is that anonymous imports with autoResolveMultipleImports flag enabled works fine.

That's it. Also please clarify if we even need to use named import today.

gajus commented 4 years ago

You don't need babel-plugin-react-css-modules if that is how you are using css-modules.

import style from './style.scss'
import typography from './../../styles/typography.scss'

<div className={`${style.content} ${typography.textblock}`}>