react-webpack-boilerplate
react-webpack-boilerplate copied to clipboard
Minimalistic ES6+ React boilerplate with Hot Reloading using Webpack 4 and Babel 7
ES6 React boilerplate using Webpack
:warning: :warning: :warning:
As of 29.12.2018, the project is DEPRECATED and no further development is planned. If you are looking for an alternative, check create-react-app.
Simple and optimized React boilerplate. It includes:
- [x] React 16.5.2
- [x] ECMAScript 6+ and JSX support
- [x] React Router v4
- [x] Component testing using Enzyme and Jest
- [x] Code Coverage
- [x] Latest Webpack (v.4.16.5), Babel 7 and Webpack Dev Server (v.4.19.1) with Scope Hoisting enabled
- [x] Hot Module Replacement using react-hot-loader
- [x] ES6 linting with continuous linting on file change
- [x] SASS support
- [x] Separate CSS stylesheets generation
- [x] Automatic HTML generation
- [x] Production Config
- [x] Custom Babel Preset with Decorators, Class Properties, Rest/Spread operator support
- [x] Export Separate Vendor Files
Starting the dev server
Make sure you have the latest Stable or LTS version of Node.js installed.
-
git clone https://github.com/KleoPetroff/react-webpack-boilerplate.git
- Run
npm install
oryarn install
- Start the dev server using
npm start
- Open http://localhost:8080
Available Commands
-
npm start
- start the dev server -
npm clean
- delete the dist folder -
npm run production
- create a production ready build indist
folder -
npm run lint
- execute an eslint check -
npm test
- run all tests -
npm run test:watch
- run all tests in watch mode -
npm run coverage
- generate code coverage report in thecoverage
folder
Vendor Exporting
You can export specific vendors in separate files and load them. All vendors should be included in app/vendors
and will be exported in a vendors
folder under dist
. The main idea is to serve independent JavaScript and CSS libraries, though currently all file formats are supported.
! Don't forget to add the vendors in app/index.html
and build/index.html
.
Code Coverage
The project is using the Jest Code Coverage tool. The reports are generated by running npm run coverage
. All configurations are located in package.json
, inside the jest
object.
The coverage report consists of an HTML reporter, which can be viewed in the browser and some helper coverage files like the coverage json and xml file.
Production code
Run npm run production
. The production-ready code will be located under dist
folder.
Licence
react-webpack-boilerplate is available under MIT.