I'm trying to show an example of using css-modules in one of the markdown files. When I use const theme = require('./themes/theme.scss'); variable comes back as an empty object. When I use similar code (but using import) in a real implementation the object is fully populated and is applied as expected.
const theme = require('~assets/css/theme/theme.module.scss');
<Alert type="warning" scene="page" message={ message } theme={ theme } />
Both Styleguidist and the regular implementation share the same webpack.config.js so that there are no differences in which plugins are used or how they are configured.
Has anyone used css-modules within a markdown example?
Just a guess, have you tried?
- const theme = require('~assets/css/theme/theme.module.scss');
+ const theme = require('~assets/css/theme/theme.module.scss').default;
Not sure what I did between when I posted and today but now it works fine. Without the need for .default added. Sorry for the noise.