我试图让ant.design.pro与我的打字稿反应应用程序一起使用,我可以正常工作,但文件较少。
它们适用于常规蚂蚁组件。
查看ant design pro项目,他们在plugin.config.js中执行以下操作:
// Change theme plugin
import MergeLessPlugin from 'antd-pro-merge-less';
import AntDesignThemePlugin from 'antd-pro-theme-webpack-plugin';
import path from 'path';
export default config => {
// 将所有 less 合并为一个供 themePlugin使用
const outFile = path.join(__dirname, '../.temp/ant-design-pro.less');
const stylesDir = path.join(__dirname, '../src/');
config.plugin('merge-less').use(MergeLessPlugin, [
{
stylesDir,
outFile,
},
]);
config.plugin('ant-design-theme').use(AntDesignThemePlugin, [
{
antDir: path.join(__dirname, '../node_modules/antd'),
stylesDir,
varFile: path.join(__dirname, '../node_modules/antd/lib/style/themes/default.less'),
mainLessFile: outFile, // themeVariables: ['@primary-color'],
indexFileName: 'index.html',
},
]);
};
我想我需要,我试图在一个react-rewired config-overrides.js中模仿它,因为config.plugin不是一个函数:
const MergeLessPlugin = require('antd-pro-merge-less');
const AntDesignThemePlugin = require('antd-pro-theme-webpack-plugin');
const path =require('path');
const webpackplugin = require('./plugin.config');
module.exports = function override(config, env) {
config.plugin('merge-less').use(MergeLessPlugin, [{
stylesDir,
outFile,
}, ]);
config.plugin('ant-design-theme').use(AntDesignThemePlugin, [{
antDir: path.join(__dirname, '../node_modules/antd'),
stylesDir,
varFile: path.join(__dirname, '../node_modules/antd/lib/style/themes/default.less'),
mainLessFile: outFile, // themeVariables: ['@primary-color'],
indexFileName: 'index.html',
}, ]);
}
任何人都知道如何实现这一目标吗?