A modern web development boilerplate for React + MobX + Webpack 4.
- React
- MobX
- Webpack 4
- Typescript
- PostCSS + CSS Modules
- HMR of components and store
- Code-splitting out of the box
- Simple routing (without react-router)
- Server-side rendering with async data loading
npm start
> visit localhost:3000
npm run build
> serve index.html
npm run build-node
> require('build/app.node.js').default('/users')
During app development, you should care about these files:
react-mobx-boilerplate/
└───src/
│
└───components/
| Core.tsx
| ...
|
└───stores/
| AppState.ts
|
└───routes.tsx
The rest can be extended if needed:
index.html
index.ts
- Entry point for browser bundleindex.node.ts
- Entry point for node (server-side rendering) bundleApp.ts
- Manages routing, contains a reference to AppStateroot.tsx
- Container component for the appwebpack/webpack-dev-server.js
- Script to run the development serverwebpack/webpack.config.js
- Webpack configuration for browser bundlewebpack/webpack.config.node.js
- Webpack configuration for node (server-side rendering) bundle
Typically, when adding a new page you'd add a route for it in routes.tsx
containing the component to render. Note that the component isn't imported directly but with import() for code splitting. Then you can add the component to the components folder and the relevant state to the store.
This project is a boilerplate and does not impose strong architectural decisions on users.
- Full SSR workflow
- Optimize bundles
- Static assets (images etc.)
- Make work with remote chrome debugging
- Add linter
- Add PostCSS plugins
- Use webpack-dev-middleware instead of webpack-dev-server