I faced the same problem.
From what i understood as I am a newbie in React, create-react-app does not compile less although it does so for sass and scss.
So you have 2( +1) options as stated in antd documentation.
- Install craco package to handle .less files as in here OR
- Eject. (An answer to what is
eject
is answered here). After injecting you can choose less-loader and modify webpack.config.js. In webpack.config.js you must add:
{
test: /\.less$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{
loader: "less-loader",
options: {
lessOptions: {
javascriptEnabled: true,
}
}
}
]
},
dont forget the javascriptEnabled: true
.
- I found another way without ejecting ( i haven't tested it ).
Personally i ejected and configured manually webpack.