react 项目 创建

react项目创建流程

ls 产看项目内文件

cd + name 进入文件

  1. 先创建一给git 仓库 ( 设置模板 必须 选择 Readme文件 勾选 )

  2. git clone ( 克隆项目 )

  3. npx create-react-app ’ name ’ 创建react项目

  4. git 4步 – git pull - - git add -all – git commit -m ’ ’ – git push 提交到git上

  5. cd name 进入项目

  6. yarn eject 开启高级模式

  7. 替换packge.json 文件里的 script内容
    8

"scripts": {
        "build-css": "node-sass-chokidar src/ -o src/",
        "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive  --use-			polling --polling-interval 1000",
        "start-js": "node scripts/start.js",
        "start": "npm-run-all -p watch-css start-js",
        "build-js": "node scripts/build.js",
        "build": "npm-run-all build-css build-js",
        "test": "node scripts/test.js --env=jsdom"
    },
  1. 安装 sass yarn add node-sass-chokidar 和 yarn add npm-run-all

  2. src 下创建style文件夹 并新建index.scss文件

  3. 进入index.js 更改css地址 改成 cass/index.scss

  4. 启动 项目 yarn start

  5. 配置代理文件 setupProxy.js 下载代理中间件 http-proxy-middleware

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值