01 create-react-app

36 阅读1分钟

安装

npm i create-react-app -g

检查安装情况

create-react-app --version

使用

create-react-app project-name

project-name为你的项目名称, 需要遵循一般的命名要求

例如

create-react-app demo-test1

1691630687126.png 记得进入demo-test1目录后再跑npm start这些命令

cd demo-test1

create-react-app默认使用sass

如果项目使用sass则不需要进行修改webpack配置文件, 但是如果使用less/stylus等则需要修改配置文件(需先暴露webpack配置文件, 如何暴露请见后续05 暴露打包配置)