React-webpack2-skeleton is a Universal React boilerplate that uses Webpack2.
- Webpack2 with url-loader, sass-loader, css-loader, babel-loader
- react-hot-loader@3.0.0
- react-router@4.0.0
- Code splitting
- Server rendering with express
- redux
- Duck structure is used in this project
- Async actions are handled by redux-promise-middleware
- ImmutableJS is used in the reducers
transit-immutable-js
is used to serialize / deserialize the Immutables
NOTE:
Babel configuration is same as create-react-app
Code splitting only works in production mode
- Node
^6.0.0
- yarn
^0.20.0
or npm^3.0.0
First, clone the project:
$ git clone https://github.com/velopert/react-webpack2-skeleton.git <project-name> $ cd <project-name>
Just in case you do not need some features, different branches are provided in this project.
Branch | Description |
---|---|
light | Pure react project environment with SCSS loader |
hmr | React-hot-loader |
router | React-router, server render, code-splitting |
$ git checkout <branch>
Then, install the dependencies. It is recommended to use Yarn, (because it is blazing fast). You can still use npm as well.
$ yarn install # or npm install
You can execute the scripts below by yarn run <script>
or npm run <script>
.
Command | Description |
---|---|
start:dev | Starts webpack development server; served at localhost:3000 |
start | Starts production server; served at localhost:8080 |
build | Bundles the source in ~/build directory |
build:server | Bundles the source to server renderer in ~/server directory |
- config # webpack configuration files - public # directory for index.html - server # server render - src # application source code ----- components # directory for presentational components ----- containers # directory for container components ----- styles # directory for appliaction styles (in scss format) --------- base # global styles --------- components # styles for each components