安装依赖

安装React

React官方文档

yarn add react react-dom

安装Webpack

Webpack官方文档

yarn add webpack --dev

安装Babel

Babel官方文档

yarn add babel-loader babel-core --dev
yarn add babel-polyfill --dev
yarn add babel-preset-es2015 --dev
yarn add babel-preset-stage-2 --dev
yarn add babel-preset-react --dev

此时,你的package.json大概长这样:

{
  "name": "react-zero-to-one",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "[email protected]:ThoughtWorksWuhanUI/react-zero-to-one.git",
  "author": "benweizhu <[email protected]>",
  "license": "MIT",
  "dependencies": {
    "react": "^15.5.4",
    "react-dom": "^15.5.4"
  },
  "devDependencies": {
    "babel-core": "^6.24.1",
    "babel-loader": "^7.0.0",
    "babel-polyfill": "^6.23.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "webpack": "^2.5.1"
  }
}

到此,可以进行第二次代码提交,但要记得将node_modules放到.gitignore中。

echo "node_modules" > .gitignore

本页编辑:Benwei

results matching ""

    No results matching ""