首先是配置alias
https://www.jianshu.com/p/7e1f1e535b8c介绍了如何配置cra的antd的less形式以及babel-plugin-import按需加载
yarn add antd @craco/craco craco-less @babel/plugin-proposal-decorators babel-plugin-import -D
根目录下创建 craco.config.js
const CracoLessPlugin = require('craco-less')
const path = require('path')
const pathResolve = pathUrl => path.join(__dirname, pathUrl)
module.exports = {
webpack: {
alias: {
'@@': pathResolve('.'),
'@': pathResolve('src'),
}
}