一、安装 antd:
npm install antd
二、安装依赖模块:
npm install react
-app
-rewired
npm install customize
-cra
npm install babel
-plugin
-import
三、设置 config-overrides.js:
首先新建一个 js 文件,如下图所示: 代码如下:
const { override
, fixBabelImports
} = require('customize-cra');
module
.exports
= override(
fixBabelImports('import', {
libraryName
: 'antd',
libraryDirectory
:'es',
style
: 'css',
}),
);
四、修改 package.json:
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject"
},