创建react项目

安装流程

【注意】:在Git Bush Here中创建,因为eject只有在线上仓库的时候才可以开启配置环境

1, 创建项目:
- js的 npx create-react-app 项目名称
- ts的 npx create-react-app 项目名称 template --typescript (之后安装路由的配置也不一样)
2,cd 到当前目录
3,git add --all
4, git commit -m ‘提交’
git status 可以查看状态
5, yarn eject 开启配置环境
6, 安装sass:
yarn add node-sass-chokidar(正常情况下也可能失败,多安装几次即可)
yarn add npm-run-all
7,修改package.json文件中的 script配置
“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”
},
8,项目安装完毕 yarn start打开项目

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值