解决方案一 :react-app-rewired
react-app-rewired 是对create-react-app 进行自定义配置的社区解决方案。它不会直接去修改create-react-app的默认配置,而是在create-react-app配置的基础上进行扩展。
解决方案二(推荐):craco
安装
yarn add --dev @craco/craco craco-less
坑
需要按如下来配置对应版本,不然存在兼容性
创建 craco.config.js ,并配置
const CracoLessPlugin = require('craco-less')module.exports = {plugins:[]}


