Struggling to implement CSS Modules for styling in my ReactJs project, I followed the ant design documentation found here: . Unfortunately, it's not working as expected when trying to override the component styles of an ant Button.
Below is a snippet from MyContainer.less file:
.antButton{
:global {
.ant-btn-primary {
background-color: rgb(215, 226, 233);
border-color: #848586;
font-size: 7pt;
color: red !important;
}
}
}
Code snippet:
import React from 'react';
import { Button } from 'antd';
import 'antd/dist/antd.less';
import styles from './MyContainer.less';
const MyContainer= () => {
return (
<Button type="primary" size="small" className={styles.antButton} >Download</Button>
);
};
export default MyContainer;
Using Ant design (Version 4.3.0) with react (Version 16.13.1) and Webpack (Version 4.42.0). Installed less-loader (Version 7.3.0) and babel-plugin-import (Version 1.13.3).
Unsure if there's a specific Webpack configuration missing or if the issue lies elsewhere?