score:3

Accepted answer

You will need the following loaders :

  1. style-loader
  2. css-loader
  3. less-loader

So basically a webpack config as follow :

module: {
    rules: [
        {
            test: /\.less$/,
            use: [
                {
                 loader: "style-loader"
                }, 
                {
                 loader: "css-loader"
                }, 
                {
                 loader: "less-loader"
                }
            ]
        }
    ]
}

Check this answer to know what each loader does.

score:0

You might want to consider https://www.styled-components.com/. This library allows you to locate your stylesheet alongside with your react components. If I am correct, using this library won't change your current webpack config.

If you want a more "traditional" approach for styling your react application, you will need at least two loaders for your webpack config: style-loader and css-loader.

less and sass loaders will be required if you intend to use css-preprocessors though.


Related Query

More Query from same tag