美文网首页JavaScript 进阶营
修改dva默认roadhog->react-create默认

修改dva默认roadhog->react-create默认

作者: 当时_寻常 | 来源:发表于2019-06-04 11:13 被阅读0次

说下修改原因,roadhog不支持flow,我习惯性使用flow做静态类型检查。以后尝试这ts看看好不好用。。。。(静态类型检查很重要,如果你不想让自己最后代码不清晰,就使用flow或ts吧)
这是dva new之后的package.json

{
  "private": true,
  "scripts": {
    "start": "roadhog server",
    "build": "roadhog build",
    "lint": "eslint --ext .js src test",
    "precommit": "npm run lint",
    "flow": "flow"
  },
  "dependencies": {
    "antd": "^3.16.5",
    "babel-plugin-import": "^1.11.0",
    "dva": "^2.4.1",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
  },
  "devDependencies": {
    "babel-plugin-dva-hmr": "^0.3.2",
    "eslint": "^4.14.0",
    "eslint-config-umi": "^0.1.1",
    "eslint-plugin-flowtype": "^2.34.1",
    "eslint-plugin-import": "^2.6.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.1.0",
    "flow-bin": "^0.97.0",
    "husky": "^0.12.0",
    "redbox-react": "^1.4.3",
    "roadhog": "^2.5.0-beta.4"
  }
}

npx create-react-app my-app之后项目的package.json如下.
当然我这边加了自己的一些依赖,忽略bootstrap和antd两个重复的ui

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "antd": "^3.16.5",
    "bootstrap": "^4.3.1",
    "flow-bin": "^0.95.1",
    "jquery": "^3.3.1",
    "react": "^16.8.4",
    "react-bootstrap": "^1.0.0-beta.6",
    "react-dom": "^16.8.4",
    "react-scripts": "2.1.8"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "flow": "flow"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "flow-bin": "^0.95.1"
  }
}

这是我修改后,package.json的样子

{
  "private": true,
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "lint": "eslint --ext .js src test",
    "precommit": "npm run lint",
    "flow": "flow"
  },
  "dependencies": {
    "@babel/core": "^7.4.3",
    "antd": "^3.16.5",
    "babel-loader": "^8.0.5",
    "babel-plugin-import": "^1.11.0",
    "dva": "^2.4.1",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-scripts": "^3.0.0"
  },
  "devDependencies": {
    "babel-plugin-dva-hmr": "^0.3.2",
    "flow-bin": "^0.97.0"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

几个月前的文章本来想完善发布的,结果回家就忘。。。哈哈哈。。。
嗯。。。如有问题,后续再更。我记得是不完善的

相关文章

  • 修改dva默认roadhog->react-create默认

    说下修改原因,roadhog不支持flow,我习惯性使用flow做静态类型检查。以后尝试这ts看看好不好用。。。。...

  • dora修改端口号

    https://github.com/dvajs/dva/issues/179 dora修改默认的8989为其他的...

  • dva项目中 cssModules

    dva项目中的样式 1.dva里的roadhog 默认会开启cssModules 配置文件: index.css文...

  • 修改默认蓝牙,热点名称和版本号

    1.修改默认蓝牙名称默认定义为Android Bluedroid,现修改为ABC。 修改如下。 2.修改默认热点名...

  • mac版本修改python默认版本

    修改默认版本:1、查看python 默认版本 默认是2.7版本 2、修改默认版本:1.打开终端,输入:open ~...

  • android默认设置项的修改

    修改默认值 在安卓源码中,要对安卓的一些默认属性配置进行修改的话(比如:修改背光默认,修改默认锁屏开关,休眠时间等...

  • 修改默认样式

    点击,聚焦input不出现框 取消select默认样式 只允许输入字符 取消input提示栏 jQuery选中被选...

  • dva 笔记

    put 等同 dispatch dva 默认所有 effect 为 takeEvery, 可以使用下面的写法实现 ...

  • 102 Spring HttpInvoke优化

    1. 修改默认的HttpInvokerRequestExecutor 默认的HttpInvokerRequestE...

  • 03.修复npm的权限

    1.修改npm默认目录的权限 查找默认目录 修改权限 2.修改npm的默认安装目录 1.新建目录 2.配置npm使...

网友评论

    本文标题:修改dva默认roadhog->react-create默认

    本文链接:https://www.haomeiwen.com/subject/kqetnqtx.html