A Simple Build Process for React and JSX
Previously, I used the reactify transform but it has been deprecated in favor of babelify. We will use babelify.
First, we install these packages.
npm install browserify watchify babelify babel-preset-react --save-dev
Next, we add some configuration to our
Here we are configuring browserify to use the babelify transform and using babel-preset-react to handle the JSX part.
Finally, we need to add some npm scripts so we can run this.
"build": "browserify index.js -o bundle.js",
"watch": "watchify index.js -vo bundle.js"
Now we are able to run
npm run watch and
npm run build. Watch will watch our files and run browserify on change. We use this while working. Build will run browserify. This is really only used by our build server.