Setting up React/Redux/React-router for ES2015+ with Webpack-dev-middleware and Babel.
- nodejs ^6.2.0
- expressjs ^4.x
$ npm install
-
Development env
$ gulp
-
Production env
$ pm2 start pm2.json
We use webpack-dev-middleware
+ webpack-hot-middleware
modules to support multiple modes to automatic refresh the page and update modules as “Hot Module Replacement” (HMR)
Restart server automaticly.
Start the server and compiles react + redux + es2015 in development environment.
Start the server in production environment
Default webpack configuration can be found in ~/server/config/
Here you'll be able to redefine your src and dist directories.adjust compilation settings, tweak your vendor dependencies, and more.
-
webpack.dev.config.js
is the webpack configuration file in development environment. Uses to compile modules as HMR mode in memory. -
webpack.config.js
is the webpack configuration file output the compiled files which will be used in production environment. -
Building for production env
$ gulp build
Run gulp
$ gulp
and then:
-
go to
localhost:1234/todo
to take a look at the react+redux example -
go to
localhost:1234/react-router
to take a look at the react-router example