2021-03-09 23:14:52 -08:00
|
|
|
require('dotenv').config();
|
|
|
|
const CracoAntDesignPlugin = require('craco-antd');
|
2021-08-31 22:00:56 -07:00
|
|
|
const path = require('path');
|
2022-02-17 03:28:06 +08:00
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
2021-03-09 23:14:52 -08:00
|
|
|
|
|
|
|
const themeConfig = require(`./src/conf/theme/${process.env.REACT_APP_THEME_CONFIG}`);
|
|
|
|
|
2021-03-11 10:06:48 -08:00
|
|
|
function addLessPrefixToKeys(styles) {
|
|
|
|
const output = {};
|
|
|
|
Object.keys(styles).forEach((key) => {
|
|
|
|
output[`@${key}`] = styles[key];
|
|
|
|
});
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2021-03-09 23:14:52 -08:00
|
|
|
module.exports = {
|
2022-02-17 03:28:06 +08:00
|
|
|
webpack: {
|
|
|
|
plugins: {
|
|
|
|
add: [
|
|
|
|
// Self host images by copying them to the build directory
|
|
|
|
new CopyWebpackPlugin({
|
|
|
|
patterns: [{ from: 'src/images', to: 'platforms' }],
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-03-09 23:14:52 -08:00
|
|
|
plugins: [
|
|
|
|
{
|
|
|
|
plugin: CracoAntDesignPlugin,
|
|
|
|
options: {
|
2021-08-31 22:00:56 -07:00
|
|
|
customizeThemeLessPath: path.join(__dirname, 'src/conf/theme/global-variables.less'),
|
2021-03-11 10:06:48 -08:00
|
|
|
customizeTheme: addLessPrefixToKeys(themeConfig.styles),
|
2021-03-09 23:14:52 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|