React 脚手架如何配置 Less 和 Ant 按需加载的方法步骤

前言

create-react-app 是由 React 官方提供并推荐使用构建新的 React 单页面应用程序的最佳方式,其构建的项目默认是不支持 Less 的,需要我们手动集成。

一、React 脚手架搭建

  1. 先全局安装 create-react-app (提前需要安装 node)
npm install -g create-react-app
  1. 然后通过 create-react-app 创建项目 my-app
create-react-app my-app
  1. 最后通过 cd 进入项目文件夹并启动
cd my-app
yarn start
  1. 终端出现如下界面表示启动成功,并在浏览器中输入 http://localhost:3000
pdf 文件大小:201.34KB