This is a barebones, minimalist example of how to use React with webpack. Thanks to Thomas Deutsch's react-webpack repo which we pulled from as an example.
This example repo is primarly for people who have existing projects. You can look and see what minimal files / settings are needed for integrating react and webpack into your project. If you're looking for a starter boiler plate for a new project I'd recommend either react-webpack for a simple starter or react-stater for a starter with all the possible bells & whistles.
Download this repository to your local project folder and run npm install
from the folder where the package.json is located.
After node.js is installed, run this command to install the webpack cli tool:
npm install webpack -g
Run webpack
to build your project into the public/build/main.bundle.js
. Run webpack -watch
from your project folder to continuously watch for changes and re-build your public/build/main.bundle.js
file. To test you can simply open your public/index.html
file in a browser.
- webpack with gulp - If you prefer to use gulp for your build/watch commands.
- webpack loaders - A list of possible loaders to let webpack handle your SASS, LESS, CSS bundling. See react-webpack as an example.
Know of any other userful things to checkout for someone implementing React + Webpack? Make a pull request and add them to the list!