A slightly opinionated yet dead simple boilerplate for ReactJS, Webpack 4 and React Router v4
Switch branches/tags
Nothing to show
Clone or download
Latest commit f6ffd7b Nov 17, 2018

README.md

logo

A slightly opinionated yet dead simple boilerplate for ReactJS, Webpack 4, and React Router v4.

build status dependency status prs welcome

Table of Contents

Live Demo

http://mikechabot.github.io/react-boilerplate/dist

Pretty landing page located here


Features

Build Process

State Management

Routing

HTTP

Styling

Develop & Deploy

Testing


Getting Started

  1. $ git clone https://github.com/mikechabot/react-boilerplate.git
  2. $ npm install
  3. Launch environment:
    • Production: $ npm start
    • Development: $ npm run dev

    Available at http://localhost:3060

  4. Build assets for production:
    • $ npm run build:prod
  5. Execute tests:
    • $ npm test

Custom Configuration

Use cross-env or a comparable library/command to set the ENV_CONFIG_PATH to the path of your JSON configuration file:

$ cross-env ENV_CONFIG_PATH=/path/to/config.json npm start

Note: This path is made available to Webpack only, however the contents of the file are stamped on a global variable during the build process (process.env.APP_CONFIG, see webpack.config.js), which is then accessible via the ConfigService.

If your configuration is loaded successfully, you can expect to see the following indicator during startup:

** Using custom configuration located at "/path/to/config.json" **

Example

Using configuration file @ D\:\_workspaces\foo.json

mikec@Krait MINGW64 /d/_workspaces/react-boilerplate (master)
$ cross-env ENV_CONFIG_PATH="D\:\_workspaces\foo.json" npm start

> react-boilerplate@2.5.0 start D:\_workspaces\react-boilerplate
> npm run prod

> react-boilerplate@2.5.0 prod D:\_workspaces\react-boilerplate
> npm run build:prod && npm run start-server

> react-boilerplate@2.5.0 build:prod D:\_workspaces\react-boilerplate
> cross-env NODE_ENV=production webpack --progress --colors

** Using custom configuration located at "D:\_workspaces\foo.json" **

Hash: 32bbf23a46e7ac19741a
Version: webpack 3.5.5
Time: 8711ms
         Asset     Size  Chunks                    Chunk Names
     bundle.js   563 kB       0  [emitted]  [big]  main
css/bundle.css  1.68 kB       0  [emitted]         main
    index.html  1.58 kB          [emitted]