Tired of complicated starters with 200MB of dependencies which are hard to understand and modify? This is for you!
What were using
- React 16
- Webpack 3
- React Router 4
- Babel Cli
- Hot Module Reloading
- Jest 21
- Enzyme 3 for testing
- Simple src/index.jsx and src/index.css (local module css).
- Webpack configuration for development (with hot reloading) and production (with minification).
- CSS module loading, so you can include your css by
import styles from './path/to.css';.
- Both js(x) and css hot loaded during development.
- Webpack Dashboard Plugin on dev server.
git clone https://github.com/ReactJSResources/react-webpack-babel.git
- Then install the dependencies:
- Run development server:
- Or you can run development server with webpack-dashboard:
npm run dev
Open the web browser to
To run unit tests:
Tests come bundled with:
- React Test Utils
- React Test Renderer
To build the production package
npm run build
Running build locally
npm run serve:build
Here is an example Nginx config:
There is a
.eslint.yaml config for eslint ready with React plugin.
To run linting, run:
npm run lint
Notes on importing css styles
- styles having /src/ in their absolute path considered part of the application and exported as local css modules.
- other styles considered global styles used by components and included in the css bundle directly.
Please contribute to the project if you know how to make it better, including this README :)