美文网首页React
Start a ReactJS project

Start a ReactJS project

作者: 天玑云象 | 来源:发表于2018-04-28 15:09 被阅读27次

Build react app using create-react-app

npm install -g create-react-app
create-react-app

npm start

Build react app from scratch

Start new project

npm init

npm install webpack webpack-cli --global

npm install react react-dom --save

npm install babel-loader babel-preset-env babel-preset-react

webpack init

Update babel setting: .babelrc

{
  "presets": [
    ["env", {
      "targets": {
        "chrome": "60",
        "node": "current"
      }
    }],
    ["react"]
  ]
}

Build and serve

webpack
# or
npm run build

npm install serve -g
serve -s build

相关文章

网友评论

    本文标题:Start a ReactJS project

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