While utilizing customize-cra to override antd less variable, I have encountered an issue where it generates multiple duplicate CSS files during the build process.
According to the documentation provided by antd, if I opt for the default import of CSS by including the following line:
@import '~antd/dist/antd.css';
It results in a combined file size of 1.5MB (including my custom CSS) after the build.
However, upon removing the @import '~antd/dist/antd.css'; line and implementing customize-cra with the following code:
const { override, fixBabelImports, addLessLoader } = require('customize-cra');
const overrideVariables = require('./src/styles/overrideVariables');
module.exports = override(
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
}),
addLessLoader({
javascriptEnabled: true,
modifyVars: overrideVariables,
}),
);
The resultant CSS files now total 6MB (including my custom CSS) post-build. Is there a correct way to implement this or any alternative solution available?