From 9dfe204a82c4d4b4f98172299d1cd428eb4627f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Mon, 2 Nov 2015 12:56:30 -0800 Subject: [PATCH] [docs] Update Getting Started for babel 6 --- docs/getting-started.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/getting-started.md b/docs/getting-started.md index 4bd3a8f41..14f1363cc 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -30,10 +30,15 @@ ReactDOM.render( To install React DOM and build your bundle after installing browserify: ```sh -$ npm install --save react react-dom -$ browserify -t babelify main.js -o bundle.js +$ npm install --save react react-dom babelify babel-preset-react +$ browserify -t [ babelify --presets [ react ] ] main.js -o bundle.js ``` +> Note: +> +> If you are using ES2015, you will want to also use the `babel-preset-es2015` package. + + ## Quick Start Without npm If you're not ready to use npm yet, you can download the starter kit which includes prebuilt copies of React and React DOM. @@ -94,16 +99,20 @@ Note that some browsers (Chrome, e.g.) will fail to load the file unless it's se First install the [Babel](http://babeljs.io/) command-line tools (requires [npm](https://www.npmjs.com/)): ``` -npm install --global babel +npm install --global babel-cli +npm install babel-preset-react ``` Then, translate your `src/helloworld.js` file to plain JavaScript: ``` -babel src --watch --out-dir build - +babel --presets react src --watch --out-dir build ``` +> Note: +> +> If you are using ES2015, you will want to also use the `babel-preset-es2015` package. + The file `build/helloworld.js` is autogenerated whenever you make a change. Read the [Babel CLI documentation](http://babeljs.io/docs/usage/cli/) for more advanced usage. ```javascript{2}