Skip to content

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

License

Notifications You must be signed in to change notification settings

zmwildan/react-boilerplate

 
 

Repository files navigation

logo

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

❤️ Webpack 4
❤️ Code splitting
❤️ React Router
❤️ Redux


Table of Contents

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


Build Process

State Management

Routing

HTTP

Styling

Develop & Deploy

Testing


  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

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]

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.6%
  • CSS 3.9%
  • HTML 2.5%