項目中Antd3與Antd4共存
本文適合使用Antd Design開發(fā)項目的小伙伴閱讀。
歡迎關(guān)注前端早茶,與廣東靚仔攜手共同進階~
作者:廣東靚仔
一、背景

二、具體的解決方案
1. 安裝? ?
npm?install?antd-v4@npm:[email protected]
? ??
2.配置less-loader
test:?/\.less$/,
include:?[/node_modules[\\|\/]antd-v4/],
use:?[
??{
????"cache-loader",
????"style-loader",
??}
??{
????loader:?"css-loader",
????options:?{
????????importLoaders:?1
????}
??},
??{
????loader:?"less-loader",
????options:?{
??????javascriptEnabled:?true,
??????modifyVars:?{
????????"@ant-prefix":?"ant-v4",
????????"@primary-color":?"rgba(224,?61,?62,?1)",?//?全局主色
????????"@link-color":?"rgba(224,?61,?62,?1)"
??????}
????}
??}
]
3.設(shè)置prefixCls
<ConfigProvider?locale={zhCN}?prefixCls="ant-v4">
4.設(shè)置語言地址
import?locale?from?'antd-v4/lib/locale/zh_CN'
三、webpack配置less-loader說明
