create-react-app myapp
npm run eject
yarn add less less-loader antd babel-plugin-import axios react-router-dom
webpack.config.dev.js
js模块
plugins:[
['import',[{ libraryName: "antd", style: true }]]
],
less模块 跟css模块一样,只显示修改地方
use: [
require.resolve('style-loader'),
require.resolve('css-loader'),
...
{
loader: require.resolve('less-loader'),
options: {
modifyVars:{ //默认样式修改
"@primary-color":"#1DA57A"
},
javascriptEnabled: true
}
}
webpack.config.prod.js配置和dev配置一样