Search code examples
reactjswebpacklessstorybook

Storybook UI with CSS modules and Less


Is it possible to use Storybook UI with React, CSS modules and Less? Have anyone managed to configure this kind of setup?


Solution

  • Adding .storybook/webpack.config.js helped me fix the issue, with

    module.exports = {
        module: {
            rules: [
                {
                    test: /\.css$/i,
                    use: ['style-loader'],
                }, {
                    test: /\.css$/,
                    use: {
                        loader: "css-loader",
                        options: {
                            modules: true,
                        }
                    }
                }
            ],
        },
    }